Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatipc has no from_ipc_mut() method #580

Open
bunnie opened this issue Sep 22, 2024 · 3 comments
Open

flatipc has no from_ipc_mut() method #580

bunnie opened this issue Sep 22, 2024 · 3 comments
Assignees

Comments

@bunnie
Copy link
Member

bunnie commented Sep 22, 2024

The Readme for flatipc gives these instructions to recover the original structure from a message:

let Some(value) = IpcSimpleValue::from_ipc_mut(&mut message.data, message.signature) else {
continue;
}

However, I'm not able to find an implementation for from_ipc_mut. Or perhaps I'm not including the right trait to find it? I notice the example uses flatipc_derive:Ipc as the derive instead of flatipc::Ipc, but swapping that out doesn't seem to help.

Can you please clarify the server-side example?

@xobs
Copy link
Member

xobs commented Sep 23, 2024

I'm sorry, you're right, the trait got renamed to from_slice_mut() to be more inline with other Rust calls, and I didn't update the README.

Let me update that.

@bunnie
Copy link
Member Author

bunnie commented Sep 23, 2024

I think it'd be also helpful to note that the signature field comes from the offset field in a memory message. Or at least I think it does? I'm not sure!

The example just says message.signature as the origin of the data, but no type is explicitly given for message and I don't find reference to signature in any of the legacy Xous APIs. But there's something buried in a proc macro that makes me think it might be offset but ideally we can call that out in the doc example.

@xobs
Copy link
Member

xobs commented Sep 23, 2024

I've updated the documentation in 0.1.2. Additionally, I've added Ipc::from_memory_message() that takes care of that for you.

See #581 and https://docs.rs/flatipc/latest/flatipc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants