Token

Enum Token 

Source
pub enum Token {
Show 14 variants UInt8(u8), UInt16(u16), UInt32(u32), Int8(i8), Int16(i16), Int32(i32), Float32(f32), Float64(f64), Char4(C4), Char256(C256), Str16(DynString<u16>), Str32(DynString<u32>), Union(PatchedMap), Vector(Vec<Token>),
}

Variants§

§

UInt8(u8)

§

UInt16(u16)

§

UInt32(u32)

§

Int8(i8)

§

Int16(i16)

§

Int32(i32)

§

Float32(f32)

§

Float64(f64)

§

Char4(C4)

§

Char256(C256)

§

Str16(DynString<u16>)

§

Str32(DynString<u32>)

§

Union(PatchedMap)

§

Vector(Vec<Token>)

Implementations§

Source§

impl Token

Source

pub fn get_by_path(&self, path: &str) -> &Token

Retrieve an immutable value by the given path. The return value will be a Token enum. using token.try_[type] function to get the actual data.

§Examples
use aoe2_probe::Scenario;

let scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario").unwrap();
//Immutable borrow author string.
let author = scenario.versio.get_by_path("/file_header/creator_name").try_str32();
Source

pub fn get_by_path_mut(&mut self, path: &str) -> &mut Token

Retrieve a mutable value by the given path. The return value will be a Token enum. using token.try_mut_[type] function to get the actual data.

§Examples
use aoe2_probe::Scenario;

//Mutable borrow author string.
let mut scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario").unwrap();
let author = scenario.versio.get_by_path_mut("/file_header/creator_name").try_mut_str32();
author.set_content("Arian");
Source

pub fn try_u8(&self) -> &u8

Source

pub fn try_mut_u8(&mut self) -> &mut u8

Source

pub fn try_u16(&self) -> &u16

Source

pub fn try_mut_u16(&mut self) -> &mut u16

Source

pub fn try_u32(&self) -> &u32

Source

pub fn try_mut_u32(&mut self) -> &mut u32

Source

pub fn try_i8(&self) -> &i8

Source

pub fn try_mut_i8(&mut self) -> &mut i8

Source

pub fn try_i16(&self) -> &i16

Source

pub fn try_mut_i16(&mut self) -> &mut i16

Source

pub fn try_i32(&self) -> &i32

Source

pub fn try_mut_i32(&mut self) -> &mut i32

Source

pub fn try_f32(&self) -> &f32

Source

pub fn try_mut_f32(&mut self) -> &mut f32

Source

pub fn try_f64(&self) -> &f64

Source

pub fn try_mut_f64(&mut self) -> &mut f64

Source

pub fn try_c4(&self) -> &C4

Source

pub fn try_mut_c4(&mut self) -> &mut C4

Source

pub fn try_c256(&self) -> &C256

Source

pub fn try_mut_c256(&mut self) -> &mut C256

Source

pub fn try_str16(&self) -> &DynString<u16>

Source

pub fn try_mut_str16(&mut self) -> &mut DynString<u16>

Source

pub fn try_str32(&self) -> &DynString<u32>

Source

pub fn try_mut_str32(&mut self) -> &mut DynString<u32>

Source

pub fn try_map(&self) -> &PatchedMap

Source

pub fn try_mut_map(&mut self) -> &mut PatchedMap

Source

pub fn try_vec(&self) -> &Vec<Token>

Source

pub fn try_mut_vec(&mut self) -> &mut Vec<Token>

Source

pub fn try_compatible_u64(&self) -> u64

Trait Implementations§

Source§

impl Clone for Token

Source§

fn clone(&self) -> Token

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Token

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Token

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Encode for Token

Source§

fn to_le_vec(&self) -> Vec<u8>

Source§

impl From<C256> for Token

Source§

fn from(char256: C256) -> Self

Converts to this type from the input type.
Source§

impl From<C4> for Token

Source§

fn from(char4: C4) -> Self

Converts to this type from the input type.
Source§

impl From<DynString<u16>> for Token

Source§

fn from(str16: DynString<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<DynString<u32>> for Token

Source§

fn from(str32: DynString<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<PatchedMap> for Token

Source§

fn from(map: PatchedMap) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Token>> for Token

Source§

fn from(vec: Vec<Token>) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Token

Source§

fn from(float32: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Token

Source§

fn from(float64: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Token

Source§

fn from(int16: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Token

Source§

fn from(int32: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Token

Source§

fn from(int8: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Token

Source§

fn from(uint16: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Token

Source§

fn from(uint32: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Token

Source§

fn from(uint8: u8) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Token

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Token

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Token

§

impl !RefUnwindSafe for Token

§

impl Send for Token

§

impl Sync for Token

§

impl Unpin for Token

§

impl !UnwindSafe for Token

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,