Skip to main content

Identifier

Struct Identifier 

Source
pub struct Identifier {
    pub namespace: Cow<'static, str>,
    pub path: Cow<'static, str>,
}
Expand description

An identifier used by Minecraft.

Fields§

§namespace: Cow<'static, str>

The namespace of the identifier.

§path: Cow<'static, str>

The path of the identifier.

Implementations§

Source§

impl Identifier

Source

pub const VANILLA_NAMESPACE: &'static str = "minecraft"

The vanilla namespace.

Source

pub fn new( namespace: impl Into<Cow<'static, str>>, path: impl Into<Cow<'static, str>>, ) -> Self

Creates a new Identifier with the given namespace and path.

Source

pub const fn new_static(namespace: &'static str, path: &'static str) -> Self

Source

pub const fn vanilla(path: String) -> Self

Creates a new Identifier with the vanilla namespace.

Source

pub const fn vanilla_static(path: &'static str) -> Self

Creates a new Identifier with the vanilla namespace and a static path.

Source

pub const fn valid_namespace_char(char: char) -> bool

Returns whether the character is a valid namespace character.

Source

pub const fn valid_char(char: char) -> bool

Returns whether the character is a valid path character.

Source

pub fn validate_namespace(namespace: &str) -> bool

Returns whether the namespace is valid.

Source

pub fn validate_path(path: &str) -> bool

Returns whether the path is valid.

Source

pub fn validate(namespace: &str, path: &str) -> bool

Returns whether the namespace and path are valid.

Trait Implementations§

Source§

impl Clone for Identifier

Source§

fn clone(&self) -> Identifier

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Identifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Identifier

Source§

fn default() -> Identifier

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Identifier

Source§

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 Display for Identifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Identifier

Source§

impl FromNbtTag for Identifier

Source§

fn from_nbt_tag(tag: NbtTag<'_, '_>) -> Option<Self>

§

fn from_optional_nbt_tag( tag: Option<NbtTag<'_, '_>>, ) -> Result<Option<Self>, DeserializeError>

Source§

impl FromStr for Identifier

Source§

type Err = &'static str

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Identifier

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl HashComponent for Identifier

Source§

fn hash_component(&self, hasher: &mut ComponentHasher)

Hashes this value into the given hasher.
Source§

fn compute_hash(&self) -> i32

Computes the hash of this value.
Source§

impl PartialEq for Identifier

Source§

fn eq(&self, other: &Identifier) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ReadFrom for Identifier

Source§

fn read(data: &mut Cursor<&[u8]>) -> Result<Self>

Reads data from a cursor.
Source§

impl<'de, C: Config> SchemaRead<'de, C> for Identifier

Source§

type Dst = Identifier

Source§

fn read( reader: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> ReadResult<()>

Read into dst from reader. Read more
§

const TYPE_META: TypeMeta = TypeMeta::Dynamic

Metadata about the type’s serialization. Read more
§

fn get(reader: impl Reader<'de>) -> Result<Self::Dst, ReadError>

Read Self::Dst from reader into a new Self::Dst.
Source§

impl<C: Config> SchemaWrite<C> for Identifier

Source§

type Src = Identifier

Source§

fn size_of(src: &Self::Src) -> WriteResult<usize>

Get the serialized size of Self::Src. Read more
Source§

fn write(writer: impl Writer, src: &Self::Src) -> WriteResult<()>

Write Self::Src to writer.
§

const TYPE_META: TypeMeta = TypeMeta::Dynamic

Metadata about the type’s serialization. Read more
Source§

impl Serialize for Identifier

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Identifier

Source§

impl ToNbtTag for Identifier

Source§

fn to_nbt_tag(self) -> NbtTag

§

fn to_optional_nbt_tag(self) -> Option<NbtTag>

Source§

impl WriteTo for Identifier

Source§

fn write(&self, writer: &mut impl Write) -> Result<()>

Writes data to a writer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<'de, T, C> Deserialize<'de, C> for T
where C: Config, T: SchemaRead<'de, C>,

§

fn deserialize(src: &'de [u8], config: C) -> Result<Self::Dst, ReadError>

Deserialize the input bytes into a new Self::Dst.
§

fn deserialize_into( src: &'de [u8], dst: &mut MaybeUninit<Self::Dst>, config: C, ) -> Result<(), ReadError>

Deserialize the input bytes into dst.
§

impl<'de, T> Deserialize<'de> for T
where T: SchemaRead<'de, Configuration>,

§

fn deserialize(src: &'de [u8]) -> Result<Self::Dst, ReadError>

Deserialize the input src bytes into a new Self::Dst.
§

fn deserialize_into( src: &'de [u8], dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>

Deserialize the input src bytes into dst.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> DeserializeOwned for T
where T: SchemaReadOwned<Configuration>,

§

fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>

Deserialize from the given [Reader] into a new Self::Dst.
§

fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>

Deserialize from the given [Reader] into dst.
§

impl<T, C> DeserializeOwned<C> for T
where C: Config, T: SchemaReadOwned<C>,

§

fn deserialize_from<'de>(src: impl Reader<'de>) -> Result<Self::Dst, ReadError>

Deserialize from the given [Reader] into a new Self::Dst.
§

fn deserialize_from_into<'de>( src: impl Reader<'de>, dst: &mut MaybeUninit<Self::Dst>, ) -> Result<(), ReadError>

Deserialize from the given [Reader] into dst.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, C> SchemaReadOwned<C> for T
where C: ConfigCore, T: for<'de> SchemaRead<'de, C>,

§

impl<T> Serialize for T
where T: SchemaWrite<Configuration> + ?Sized,

§

fn serialize(src: &Self::Src) -> Result<Vec<u8>, WriteError>

Serialize a serializable type into a Vec of bytes.
§

fn serialize_into(dst: impl Writer, src: &Self::Src) -> Result<(), WriteError>

Serialize a serializable type into the given byte buffer.
§

fn serialized_size(src: &Self::Src) -> Result<u64, WriteError>

Get the size in bytes of the type when serialized.
§

impl<T, C> Serialize<C> for T
where C: Config, T: SchemaWrite<C> + ?Sized,

§

fn serialize(src: &Self::Src, config: C) -> Result<Vec<u8>, WriteError>

Serialize a serializable type into a Vec of bytes.
§

fn serialize_into( dst: impl Writer, src: &Self::Src, config: C, ) -> Result<(), WriteError>

Serialize a serializable type into the given [Writer].
§

fn serialized_size(src: &Self::Src, config: C) -> Result<u64, WriteError>

Get the size in bytes of the type when serialized.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more