pub struct NbtPath {
original: String,
nodes: Vec<NbtPathNodeEntry>,
}Expand description
Parsed vanilla NBT path.
Fields§
§original: String§nodes: Vec<NbtPathNodeEntry>Implementations§
Source§impl NbtPath
impl NbtPath
Sourcepub fn count_matching(&self, tag: &NbtTag) -> usize
pub fn count_matching(&self, tag: &NbtTag) -> usize
Returns the number of tags matched by this path.
Sourcepub fn set(
&self,
tag: &mut NbtTag,
value: NbtTag,
) -> Result<usize, NbtPathMutationError>
pub fn set( &self, tag: &mut NbtTag, value: NbtTag, ) -> Result<usize, NbtPathMutationError>
Sets every tag selected by this path to value.
Missing intermediate compound/list parents are created the same way
vanilla’s NbtPathArgument.NbtPath#set creates them. The return value is
the number of changed target tags.
§Errors
Returns an error if an intermediate path node cannot resolve or if the inserted value would exceed vanilla’s maximum NBT depth.
fn set_at( &self, tag: &mut NbtTag, node_index: usize, value: &NbtTag, ) -> Result<SetOutcome, NbtPathMutationError>
Trait Implementations§
impl StructuralPartialEq for NbtPath
Auto Trait Implementations§
impl Freeze for NbtPath
impl RefUnwindSafe for NbtPath
impl Send for NbtPath
impl Sync for NbtPath
impl Unpin for NbtPath
impl UnsafeUnpin for NbtPath
impl UnwindSafe for NbtPath
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreWraps this value in an
Arc<SyncMutex<>>