Skip to main content

MessageSource

Struct MessageSource 

Source
pub struct MessageSource<'a>(/* private fields */);
Expand description

The public seam for “where does this operation’s message come from?” — the one parameter type op constructors accept. It has exactly two adapters: plain bytes (borrowed now, copied into librnp-owned memory at execution) and a caller-built Input (passed through untouched, so reader-backed streaming works). Construct via Into from either — &[u8], string literals/arrays (b"..."), or an Input.

let from_bytes: MessageSource = b"plain bytes".into();
let from_input: MessageSource = Input::from_memory(b"streamed").unwrap().into();
let _ = (from_bytes, from_input);

Implementations§

Source§

impl<'a> MessageSource<'a>

Source

pub fn from_bytes(bytes: &'a [u8]) -> Self

Borrowed bytes; copied into librnp-owned memory when the operation executes.

Source

pub fn from_input(input: Input) -> Self

A caller-built Input — e.g. from Input::from_reader — passed through untouched so streaming sources work.

Trait Implementations§

Source§

impl<'a> Debug for MessageSource<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a Vec<u8>> for MessageSource<'a>

Source§

fn from(bytes: &'a Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<&'a [u8; N]> for MessageSource<'a>

Source§

fn from(bytes: &'a [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a [u8]> for MessageSource<'a>

Source§

fn from(bytes: &'a [u8]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Input> for MessageSource<'a>

Source§

fn from(input: Input) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for MessageSource<'a>

§

impl<'a> !Send for MessageSource<'a>

§

impl<'a> !Sync for MessageSource<'a>

§

impl<'a> !UnwindSafe for MessageSource<'a>

§

impl<'a> Freeze for MessageSource<'a>

§

impl<'a> Unpin for MessageSource<'a>

§

impl<'a> UnsafeUnpin for MessageSource<'a>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.