Skip to content

Converting a RouteError to an Error #313

@cwmos

Description

@cwmos

I am new to rust and hence also to Neli.

I am reading netlink messages using Tokio and the async API.

To do this, I call the next function on NlRouterReceiverHandle and it gives a return value with type:

Option<Result<Nlmsghdr<GenlId, Genlmsghdr<Cmd, Attr>>, RouterError<GenlId, Genlmsghdr<Cmd, Attr>>>>

I would like to take the RouterError and convert it to a more generic Box<dyn Error> that I can return back from my library. However, that does not seem to be possible. I get errors like:

the parameter type `Cmd` may not live long enough
the parameter type `Attr` may not live long enough

Any hints on what I should do? I would imagine it is best practice that an error can be converted to a Box<dyn Error>? perhaps there is potential for improvements to Neli?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions