pub enum ImageSource {
Item(String),
Block(String),
Sprite(String),
ModPath(String),
Texture(String),
}Expand description
A parsed image source — see the module docs.
Variants§
Item(String)
item:<id> — a namespaced item id.
Block(String)
block:<id> — a namespaced block id (drawn as its item).
Sprite(String)
sprite:<name> — a SPRITES name, or a raw GUI-atlas sprite id
when it has a namespace (sprite:minecraft:widget/button, 1.20.2+).
ModPath(String)
mod:<path> — the calling mod’s own texture; needs the mod id
(see ImageSource::with_mod_id).
Texture(String)
A texture resource id, <ns>:textures/<path>.png.
Implementations§
Source§impl ImageSource
impl ImageSource
Sourcepub fn parse(source: &str) -> Option<ImageSource>
pub fn parse(source: &str) -> Option<ImageSource>
Parses a source string; None for an empty or malformed one.
Sourcepub fn with_mod_id(self, mod_id: &str) -> ImageSource
pub fn with_mod_id(self, mod_id: &str) -> ImageSource
Resolves mod:<path> against mod_id (others are unchanged).
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ImageSource
impl Debug for ImageSource
Source§impl Display for ImageSource
The source as written: item:minecraft:apple, sprite:button; a
texture as its resource id.
impl Display for ImageSource
The source as written: item:minecraft:apple, sprite:button; a
texture as its resource id.
impl Eq 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 UnsafeUnpin 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