pub enum Handle {
Path(Id, PathBuf),
Bytes(Id, Bytes),
Rgba {
id: Id,
width: u32,
height: u32,
pixels: Bytes,
},
}
Expand description
A handle of some image data.
Variants§
Path(Id, PathBuf)
A file handle. The image data will be read from the file path.
Use from_path
to create this variant.
Bytes(Id, Bytes)
A handle pointing to some encoded image bytes in-memory.
Use from_bytes
to create this variant.
Rgba
A handle pointing to decoded image pixels in RGBA format.
Use from_rgba
to create this variant.
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn from_path<T: Into<PathBuf>>(path: T) -> Handle
pub fn from_path<T: Into<PathBuf>>(path: T) -> Handle
Creates an image Handle
pointing to the image of the given path.
Makes an educated guess about the image format by examining the data in the file.
Sourcepub fn from_bytes(bytes: impl Into<Bytes>) -> Handle
pub fn from_bytes(bytes: impl Into<Bytes>) -> Handle
Creates an image Handle
containing the encoded image data directly.
Makes an educated guess about the image format by examining the given data.
This is useful if you already have your image loaded in-memory, maybe because you downloaded or generated it procedurally.
Trait Implementations§
impl Eq for Handle
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl !Freeze for Handle
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
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