[−][src]Struct nobility::bin_encode::CompoundWriter
A builder for a TAG_Compound, allowing fields to be added sequentially.
Example
let mut compound = some_compound; compound.field("Name").string("Alice"); let mut pos = compound.compound_field("Position"); pos.field("X").int(34); pos.field("Y").int(12); pos.finish(); // finish() call is required. compound.finish();
Panics
This object will panic on drop if finish() is not called. Otherwise, an invalid NBT document would be generated.
Implementations
impl<'a> CompoundWriter<'a>
[src]
pub fn field<'b>(&'b mut self, name: &'b str) -> TagWriter<'b>
[src]
Create a new field and return a builder for filling in its value.
pub fn compound_field<'b>(&'b mut self, name: &'b str) -> CompoundWriter<'b>
[src]
Creates a compound field. The reason to use this is that
.field(name).compound()
has too short of a lifetime for the
intermediate TagWriter, and would have to be spread across
multiple variables, causing verbose code.
pub fn compound_list_field<'b>(
&'b mut self,
name: &'b str
) -> CompoundListWriter<'b>
[src]
&'b mut self,
name: &'b str
) -> CompoundListWriter<'b>
Creates a list of compounds. The reason to use this is that
.field(name).compound_list()
has too short of a lifetime for
the intermediate TagWriter, and would have to be spread across
multiple variables, causing verbose code.
pub fn finish(self)
[src]
Finishes the compound tag. This must be called after you're done appending elements, or a panic will occur on drop.
Trait Implementations
impl<'a> Debug for CompoundWriter<'a>
[src]
impl<'a> Drop for CompoundWriter<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for CompoundWriter<'a>
[src]
impl<'a> Send for CompoundWriter<'a>
[src]
impl<'a> Sync for CompoundWriter<'a>
[src]
impl<'a> Unpin for CompoundWriter<'a>
[src]
impl<'a> !UnwindSafe for CompoundWriter<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,