pub struct RecipeId {
pub namespace: String,
pub path: String,
}Expand description
Stable identifier for a crafting recipe.
The wire form is "namespace:path". Both segments are
non-empty UTF-8 strings; RecipeId::parse enforces this on
input. Equality is by exact namespace + path.
Fields§
§namespace: StringNamespace segment (e.g. "minecraft", "my_plugin").
path: StringPath segment (e.g. "oak_planks", "shaped_42").
Implementations§
Source§impl RecipeId
impl RecipeId
Sourcepub fn new(namespace: impl Into<String>, path: impl Into<String>) -> Self
pub fn new(namespace: impl Into<String>, path: impl Into<String>) -> Self
Constructs a RecipeId from explicit namespace and path.
Both arguments are taken via Into<String> so callers can
pass &str, owned String, or any other convertible type.
Sourcepub fn vanilla(path: impl Into<String>) -> Self
pub fn vanilla(path: impl Into<String>) -> Self
Constructs a vanilla RecipeId under the "minecraft" namespace.
Shorthand for RecipeId::new("minecraft", path).
Sourcepub fn parse(input: &str) -> Option<Self>
pub fn parse(input: &str) -> Option<Self>
Parses a "namespace:path" string into a RecipeId.
Returns None if the input does not contain exactly one colon
or if either segment is empty. The split is on the first
colon, so paths with embedded colons are not supported (and
no current Mojang recipe has one).
Trait Implementations§
impl Eq for RecipeId
impl StructuralPartialEq for RecipeId
Auto Trait Implementations§
impl Freeze for RecipeId
impl RefUnwindSafe for RecipeId
impl Send for RecipeId
impl Sync for RecipeId
impl Unpin for RecipeId
impl UnsafeUnpin for RecipeId
impl UnwindSafe for RecipeId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.