pub enum ImageSource {
Uri(Uri),
Path(PathBuf),
Bytes(&'static str, Bytes),
}Expand description
§URI
Good to load remote images.
Needs the
remote-assetfeature enabled.
let source: ImageSource =
"https://upload.wikimedia.org/wikipedia/commons/8/8a/Gecarcinus_quadratus_%28Nosara%29.jpg"
.into();§Path
Good for dynamic loading.
let source: ImageSource = PathBuf::from("./examples/rust_logo.png").into();§Raw bytes
Good for embedded images.
let source: ImageSource = (
"rust-logo",
include_bytes!("../../../examples/rust_logo.png"),
)
.into();Variants§
Uri(Uri)
Remote image loaded from a URI.
Requires the remote-asset feature.
Path(PathBuf)
Bytes(&'static str, Bytes)
Implementations§
Trait Implementations§
Source§impl Clone for ImageSource
impl Clone for ImageSource
Source§fn clone(&self) -> ImageSource
fn clone(&self) -> ImageSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<&'static str> for ImageSource
Available on crate feature remote-asset only.
impl From<&'static str> for ImageSource
Available on crate feature
remote-asset only.Source§fn from(src: &'static str) -> ImageSource
fn from(src: &'static str) -> ImageSource
Converts to this type from the input type.
Source§impl From<PathBuf> for ImageSource
impl From<PathBuf> for ImageSource
Source§fn from(path: PathBuf) -> ImageSource
fn from(path: PathBuf) -> ImageSource
Converts to this type from the input type.
Source§impl From<Uri> for ImageSource
Available on crate feature remote-asset only.
impl From<Uri> for ImageSource
Available on crate feature
remote-asset only.Source§fn from(uri: Uri) -> ImageSource
fn from(uri: Uri) -> ImageSource
Converts to this type from the input type.
Source§impl Hash for ImageSource
impl Hash for ImageSource
Source§impl PartialEq for ImageSource
impl PartialEq for ImageSource
impl StructuralPartialEq for ImageSource
Auto Trait Implementations§
impl !Freeze for ImageSource
impl RefUnwindSafe for ImageSource
impl Send for ImageSource
impl Sync for ImageSource
impl Unpin for ImageSource
impl UnwindSafe for ImageSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> ComponentProps for T
impl<T> ComponentProps for T
§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