pub struct GroupBuilder<'a> { /* private fields */ }Expand description
A group of a record being built.
Implementations§
Source§impl GroupBuilder<'_>
impl GroupBuilder<'_>
Sourcepub fn set_u32(&mut self, name: &str, value: u32) -> Result<&mut Self>
pub fn set_u32(&mut self, name: &str, value: u32) -> Result<&mut Self>
Replaces an unsigned leaf, keeping its type.
Games write integers and floats with their compact encoding when the value has one, so the leaf gets the
optimized flag a decoded startpos would have.
§Errors
Returns an error if the field doesn’t exist or isn’t an unsigned integer.
Sourcepub fn set_i32(&mut self, name: &str, value: i32) -> Result<&mut Self>
pub fn set_i32(&mut self, name: &str, value: i32) -> Result<&mut Self>
Replaces a signed leaf, keeping its type. See Self::set_u32 for its optimized flag.
§Errors
Returns an error if the field doesn’t exist or isn’t a signed integer.
Sourcepub fn set_f32(&mut self, name: &str, value: f32) -> Result<&mut Self>
pub fn set_f32(&mut self, name: &str, value: f32) -> Result<&mut Self>
Replaces a float leaf. Only zero has a compact encoding: see Self::set_u32 for its optimized flag.
§Errors
Returns an error if the field doesn’t exist or isn’t a float.
Sourcepub fn set_bool(&mut self, name: &str, value: bool) -> Result<&mut Self>
pub fn set_bool(&mut self, name: &str, value: bool) -> Result<&mut Self>
Replaces a boolean leaf, keeping its encoding.
§Errors
Returns an error if the field doesn’t exist or isn’t a boolean.
Sourcepub fn set_str(&mut self, name: &str, value: &str) -> Result<&mut Self>
pub fn set_str(&mut self, name: &str, value: &str) -> Result<&mut Self>
Replaces a string leaf (ASCII or UTF-16).
§Errors
Returns an error if the field doesn’t exist or isn’t a string.
Sourcepub fn push_child(&mut self, node: NodeType) -> Result<&mut Self>
pub fn push_child(&mut self, node: NodeType) -> Result<&mut Self>
Sourcepub fn set_strings(
&mut self,
name: &str,
values: Vec<String>,
) -> Result<&mut Self>
pub fn set_strings( &mut self, name: &str, values: Vec<String>, ) -> Result<&mut Self>
Replaces a string array leaf (ASCII or UTF-16).
§Errors
Returns an error if the field doesn’t exist or isn’t a string array.
Sourcepub fn set_bytes(&mut self, name: &str, values: Vec<u8>) -> Result<&mut Self>
pub fn set_bytes(&mut self, name: &str, values: Vec<u8>) -> Result<&mut Self>
Replaces a byte array leaf (U8Array or I8Array).
§Errors
Returns an error if the field doesn’t exist or isn’t a byte array.
Sourcepub fn set_u32s(&mut self, name: &str, values: Vec<u32>) -> Result<&mut Self>
pub fn set_u32s(&mut self, name: &str, values: Vec<u32>) -> Result<&mut Self>
Replaces an unsigned array leaf. Games write non-empty arrays with the compact encoding when every value has
one, so the leaf gets the optimized flag a decoded startpos would have.
§Errors
Returns an error if the field doesn’t exist or isn’t an unsigned array.
Sourcepub fn unset(&mut self, name: &str) -> Result<&mut Self>
pub fn unset(&mut self, name: &str) -> Result<&mut Self>
Leaves an optional leaf out of the record.
§Errors
Returns an error if the field doesn’t exist or isn’t optional.
Sourcepub fn set_record(
&mut self,
key: &str,
record: Option<RecordNode>,
) -> Result<&mut Self>
pub fn set_record( &mut self, key: &str, record: Option<RecordNode>, ) -> Result<&mut Self>
Trait Implementations§
Source§impl<'a> Clone for GroupBuilder<'a>
impl<'a> Clone for GroupBuilder<'a>
Source§fn clone(&self) -> GroupBuilder<'a>
fn clone(&self) -> GroupBuilder<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for GroupBuilder<'a>
impl<'a> RefUnwindSafe for GroupBuilder<'a>
impl<'a> Send for GroupBuilder<'a>
impl<'a> Sync for GroupBuilder<'a>
impl<'a> Unpin for GroupBuilder<'a>
impl<'a> UnsafeUnpin for GroupBuilder<'a>
impl<'a> UnwindSafe for GroupBuilder<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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 moreimpl<T> MaybeSend for T
impl<T> MaybeSync for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.