pub struct QJSONDocument {
pub tag: u32,
pub version: u32,
pub base: JsonBaseValue,
}
Expand description
A QJSONDocument is the root of every parsed JSOn Document. It consists out of metadata and a base
Fields§
§tag: u32
This will be “qbjs” encoded in an u32
version: u32
The QBJS Version. This needs to be 1
base: JsonBaseValue
The Base element of the document. It muse either be an Array or an Object
Implementations§
Source§impl QJSONDocument
impl QJSONDocument
Sourcepub fn from_binary(data: Vec<u8>) -> Result<Self, Error>
pub fn from_binary(data: Vec<u8>) -> Result<Self, Error>
Parses a binary VEC into a QJSONDocument
Examples found in repository?
examples/minimal.rs (line 14)
5fn main() {
6 env_logger::init();
7 let json_data = b"qbjs\
8 \x01\x00\x00\x00\
9 \x10\x00\x00\x00\
10 \x02\x00\x00\x00\
11 \x0C\x00\x00\x00\
12 \x4A\x01\x00\x00";
13
14 let document = QJSONDocument::from_binary(json_data.to_vec()).unwrap();
15
16 // Prints an Array with 10 as value
17 println!("{:?}", document.base);
18}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QJSONDocument
impl RefUnwindSafe for QJSONDocument
impl Send for QJSONDocument
impl Sync for QJSONDocument
impl Unpin for QJSONDocument
impl UnwindSafe for QJSONDocument
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