pub struct Identifier(/* private fields */);Expand description
A resource identifier encoded as a PrefixedString.
The namespace permits [a-z0-9._-]; the value permits
[a-z0-9._/-]. See the protocol’s identifier format for details.
Implementations§
Source§impl Identifier
impl Identifier
Sourcepub const MAX_UTF16_CODE_UNITS: usize = PrefixedString::MAX_UTF16_CODE_UNITS
pub const MAX_UTF16_CODE_UNITS: usize = PrefixedString::MAX_UTF16_CODE_UNITS
The maximum number of UTF-16 code units permitted in the identifier.
Sourcepub const MAX_BYTES: usize = PrefixedString::MAX_BYTES
pub const MAX_BYTES: usize = PrefixedString::MAX_BYTES
The maximum size of the UTF-8 payload, excluding its VarInt length prefix.
Sourcepub const MAX_ENCODED_BYTES: usize
pub const MAX_ENCODED_BYTES: usize
The maximum encoded size, including the VarInt length prefix.
Sourcepub fn new(value: impl Into<String>) -> Result<Self, InvalidIdentifier>
pub fn new(value: impl Into<String>) -> Result<Self, InvalidIdentifier>
Creates an identifier after validating its namespace and path.
An identifier without an explicit namespace is validated as belonging
to the minecraft namespace, but its original spelling is preserved.
§Errors
Returns InvalidIdentifier if the namespace or path is empty or
contains a character not permitted by the identifier format.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Returns the owned identifier string.
Trait Implementations§
Source§impl Clone for Identifier
impl Clone for Identifier
Source§fn clone(&self) -> Identifier
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Identifier
impl Debug for Identifier
Source§impl<'de> Deserialize<'de> for Identifier
impl<'de> Deserialize<'de> for Identifier
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 Display for Identifier
impl Display for Identifier
impl Eq for Identifier
Source§impl From<Identifier> for IdSet
impl From<Identifier> for IdSet
Source§fn from(tag_name: Identifier) -> Self
fn from(tag_name: Identifier) -> Self
Converts to this type from the input type.
Source§impl Hash for Identifier
impl Hash for Identifier
Source§impl PartialEq for Identifier
impl PartialEq for Identifier
Source§impl Serialize for Identifier
impl Serialize for Identifier
impl StructuralPartialEq for Identifier
Auto Trait Implementations§
impl Freeze for Identifier
impl RefUnwindSafe for Identifier
impl Send for Identifier
impl Sync for Identifier
impl Unpin for Identifier
impl UnsafeUnpin for Identifier
impl UnwindSafe for Identifier
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§impl<T> ContextualCodec for Twhere
T: TypeCodec,
impl<T> ContextualCodec for Twhere
T: TypeCodec,
Source§fn encode_with_context(
&self,
writer: &mut impl Write,
_context: &Context,
) -> Result<(), CodecError>
fn encode_with_context( &self, writer: &mut impl Write, _context: &Context, ) -> Result<(), CodecError>
Encodes this value using context supplied by its enclosing structure.
Source§fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
Decodes this value using context supplied by its enclosing structure.