Struct oscore_msg_native_t

Source
#[repr(C)]
pub struct oscore_msg_native_t(/* private fields */);
Expand description

The message type is conveniently already more pointer-like; given that we pass around pointers to a concrete type (albeit possibly an enum), it’s just that.

The current convention this crate adheres to is to go through a level of indirection (being a pointer to the Message enum) rather than the full enum itself. The latter is well within the design space of libOSCORE, but given that there is as of 2022 some confusion about WASM’s ABI (C and Rust-on-some-target-triples disagree on whether they are passed by value or by reference on the ABI level when passed by value on the API level), a small struct is preferable.

If &dyn the-required-traits were possible, we could also pass that (subject to the same limitations as passing the full enum).

The void pointer hides a [Message] enum (because it can’t be repr(C)) that always has “sufficient” lifetime (we have to trust the C side on that).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.