Trait cuivre::resources::Loadable [−][src]
pub trait Loadable where
Self: Sized, { type LoadOptions; type LoadError: Error + From<Error>; fn load_from_bytes(
data: &[u8],
options: Self::LoadOptions
) -> Result<Self, Self::LoadError>; fn load_from_file<P: AsRef<OsStr>>(
path: P,
options: Self::LoadOptions
) -> Result<Self, Self::LoadError> { ... } }
Represents a type that can be loaded from a file or byte sequence.
Associated Types
type LoadOptions
Type of an additional argument that can be supplied to the load
methods.
Can use () if additional options are not needed.
type LoadError: Error + From<Error>
Error type that can be by the load
methods.
Use io::Error if loading from bytes cannot fail.
Required Methods
fn load_from_bytes(
data: &[u8],
options: Self::LoadOptions
) -> Result<Self, Self::LoadError>
data: &[u8],
options: Self::LoadOptions
) -> Result<Self, Self::LoadError>
Loads the object from a byte sequence.
Provided Methods
fn load_from_file<P: AsRef<OsStr>>(
path: P,
options: Self::LoadOptions
) -> Result<Self, Self::LoadError>
path: P,
options: Self::LoadOptions
) -> Result<Self, Self::LoadError>
Loads the object from a file.
Supplied path
is relative to the game executable
directory.
Implementors
impl Loadable for Shader type LoadOptions = ShaderType; type LoadError = ShaderError;
impl<'a> Loadable for Font<'a> type LoadOptions = (); type LoadError = FontError;
impl Loadable for Texture type LoadOptions = TextureOptions; type LoadError = TextureError;