Skip to main content

ParamSource

Enum ParamSource 

Source
pub enum ParamSource<'a> {
    Text(&'a str),
    Binary(&'a [u8]),
    File(&'a Path),
    Reader(&'a DataReader),
}
Expand description

Where a network reads its parameters from.

A text or binary source keeps the parameters in memory, a file source lets the native stdio loader read the path, and a reader source serves an archive or an embedded asset.

Variants§

§

Text(&'a str)

Text parameters, starting with the 7767517 magic line.

§

Binary(&'a [u8])

Parameters in the binary form ncnn2mem writes, which needs no text parsing.

§

File(&'a Path)

A file the native stdio loader opens.

§

Reader(&'a DataReader)

A reader that owns its bytes or file.

Trait Implementations§

Source§

impl<'a> From<&'a DataReader> for ParamSource<'a>

Source§

fn from(reader: &'a DataReader) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Path> for ParamSource<'a>

Source§

fn from(path: &'a Path) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PathBuf> for ParamSource<'a>

Source§

fn from(path: &'a PathBuf) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for ParamSource<'a>

Source§

fn from(text: &'a str) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

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

§

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

§

impl<'a> Freeze for ParamSource<'a>

§

impl<'a> RefUnwindSafe for ParamSource<'a>

§

impl<'a> Unpin for ParamSource<'a>

§

impl<'a> UnsafeUnpin for ParamSource<'a>

§

impl<'a> UnwindSafe for ParamSource<'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, !>

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.