[−][src]Struct nobility::bin_decode::Document
Represents an NBT document and is the owner of the data contained in it. All other decoder types are borrows of the data stored in this.
Example
use nobility::bin_decode::Document; // Either copies the data (plaintext) or decompresses it (gzip). Accepts // any implementation of Read. let doc = Document::load(input)?; // Returns the root tag's name, and the root tag (always a Compound tag). // Both of these are borrowing the data inside the Document. let (name, root) = doc.parse()?;
Implementations
impl Document
[src]
pub fn load<R: Read + Clone>(input: R) -> Result<Document, IoError>
[src]
Loads a document from any source implementing Read. Sources that are compressed with gzip will be automatically decompressed, otherwise the data will just be copied.
Errors
Errors from this function are either from the input Read object or from GzDecoder.
pub fn parse(&self) -> Result<(NbtString<'_>, Compound<'_>), ParseError>
[src]
Parses the document and returns the name and contents of the root tag.
Errors
The only cases that this should return an error are:
- The input is not an NBT document. This will likely generate ParseError::IncorrectStartTag.
- The input is an NBT document, but is malformed/corrupted, or in the Bedrock edition version of the format.
- The document is compressed using something other than gzip. This will likely generate ParseError::IncorrectStartTag.
- The specification has changed due to a new Minecraft version. This will likely generate ParseError::UnknownTag.
- There's a bug in the parser.
Trait Implementations
impl Clone for Document
[src]
impl Debug for Document
[src]
impl PartialEq<Document> for Document
[src]
impl StructuralPartialEq for Document
[src]
Auto Trait Implementations
impl RefUnwindSafe for Document
[src]
impl Send for Document
[src]
impl Sync for Document
[src]
impl Unpin for Document
[src]
impl UnwindSafe for Document
[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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,