Struct veloren_common_assets::loader::LoadFrom
pub struct LoadFrom<U, L>(PhantomData<(U, L)>);
Expand description
Loads assets from another type.
An example case for this is to easily load wrapper types, which are needed when the wrapped type is defined in another crate.
§Example
use assets_manager::{Asset, loader::{LoadFrom, ParseLoader}};
use std::net::IpAddr;
struct Ip(IpAddr);
impl From<IpAddr> for Ip {
fn from(ip: IpAddr) -> Ip {
Ip(ip)
}
}
impl Asset for Ip {
const EXTENSION: &'static str = "ip";
type Loader = LoadFrom<IpAddr, ParseLoader>;
}
Tuple Fields§
§0: PhantomData<(U, L)>
Trait Implementations§
Auto Trait Implementations§
impl<U, L> Freeze for LoadFrom<U, L>
impl<U, L> RefUnwindSafe for LoadFrom<U, L>where
U: RefUnwindSafe,
L: RefUnwindSafe,
impl<U, L> Send for LoadFrom<U, L>
impl<U, L> Sync for LoadFrom<U, L>
impl<U, L> Unpin for LoadFrom<U, L>
impl<U, L> UnwindSafe for LoadFrom<U, L>where
U: UnwindSafe,
L: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more