Enum veloren_common::terrain::sprite::Category
source · #[repr(u32)]pub enum Category {
Void = 0,
Misc = 1,
Furniture = 2,
Plant = 3,
Resource = 4,
MineableResource = 5,
Structural = 6,
Decor = 7,
Lamp = 8,
Container = 9,
Modular = 10,
}
Variants§
Void = 0
Misc = 1
Furniture = 2
Plant = 3
Resource = 4
MineableResource = 5
Structural = 6
Decor = 7
Lamp = 8
Container = 9
Modular = 10
Implementations§
source§impl Category
impl Category
source§impl Category
impl Category
pub const fn all() -> &'static [Self]
pub const fn sprite_id_mask(&self) -> u32
pub const fn sprite_id_size(&self) -> u32
pub const fn sprite_kind_mask(&self) -> u32
sourcepub(super) const fn from_block(block: Block) -> Option<Self>
pub(super) const fn from_block(block: Block) -> Option<Self>
Note that this function assumes that the BlockKind
of block
permits sprite inhabitants
(i.e: is unfilled).
pub const fn attr_offsets(&self) -> &[Option<u8>; 6]
sourcepub fn has_attr<A: Attribute>(&self) -> bool
pub fn has_attr<A: Attribute>(&self) -> bool
Returns true
if this category of sprite has the given attribute.
sourcepub(super) fn read_attr<A: Attribute>(
&self,
block: Block,
) -> Result<A, AttributeError<A::Error>>
pub(super) fn read_attr<A: Attribute>( &self, block: Block, ) -> Result<A, AttributeError<A::Error>>
Read an attribute from the given block.
Note that this function assumes that the category of self
matches that of the block, but does
not validate this.
sourcepub(super) fn write_attr<A: Attribute>(
&self,
block: &mut Block,
attr: A,
) -> Result<(), AttributeError<Infallible>>
pub(super) fn write_attr<A: Attribute>( &self, block: &mut Block, attr: A, ) -> Result<(), AttributeError<Infallible>>
Write an attribute to the given block.
Note that this function assumes that the category of self
matches that of the block, but does
not validate this.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Category
impl<'de> Deserialize<'de> for Category
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromPrimitive for Category
impl FromPrimitive for Category
source§fn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
Converts an
i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
Converts an
u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
Converts an
isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
Converts an
i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
Converts an
i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
Converts an
i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
Converts an
i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§fn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
Converts a
usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
Converts an
u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
Converts an
u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
Converts an
u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.source§fn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
Converts an
u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moresource§impl IntoEnumIterator for Category
impl IntoEnumIterator for Category
type Iterator = CategoryIter
fn iter() -> CategoryIter ⓘ
source§impl<Target> PackedElim for WeakHead<Category, Target>
impl<Target> PackedElim for WeakHead<Category, Target>
type Void = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Misc = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Furniture = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Plant = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Resource = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type MineableResource = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Structural = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Decor = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Lamp = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Container = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
type Modular = <WeakHead<Pure<Target>, Target> as SynthTyped<(), Target>>::Expr
source§impl PartialEq for Category
impl PartialEq for Category
source§impl<Context, Target> SynthTyped<((Category,), Context), Target> for WeakHead<Category, Target>
impl<Context, Target> SynthTyped<((Category,), Context), Target> for WeakHead<Category, Target>
impl Copy for Category
impl Eq for Category
impl StructuralPartialEq for Category
Auto Trait Implementations§
impl Freeze for Category
impl RefUnwindSafe for Category
impl Send for Category
impl Sync for Category
impl Unpin for Category
impl UnwindSafe for Category
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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<C, M> ConvertSaveload<M> for C
impl<C, M> ConvertSaveload<M> for C
§type Error = Infallible
type Error = Infallible
Error may occur during serialization or deserialization of component
§fn convert_into<F>(
&self,
_: F,
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
Convert this data type into serializable form (
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F,
) -> Result<C, <C as ConvertSaveload<M>>::Error>
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
Convert this data from a deserializable form (
Data
) using
entity to marker mapping function§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§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