pub struct TypeTreeBuilder { /* private fields */ }Expand description
TypeTree builder
This struct provides methods for building TypeTree structures programmatically, including validation and optimization.
Implementations§
Source§impl TypeTreeBuilder
impl TypeTreeBuilder
Sourcepub fn new() -> TypeTreeBuilder
pub fn new() -> TypeTreeBuilder
Create a new TypeTree builder
Sourcepub fn with_capacity(capacity: usize) -> TypeTreeBuilder
pub fn with_capacity(capacity: usize) -> TypeTreeBuilder
Create a builder with initial capacity
Sourcepub fn version(self, version: u32) -> TypeTreeBuilder
pub fn version(self, version: u32) -> TypeTreeBuilder
Set TypeTree version
Sourcepub fn platform(self, platform: u32) -> TypeTreeBuilder
pub fn platform(self, platform: u32) -> TypeTreeBuilder
Set platform
Sourcepub fn has_type_dependencies(self, has_deps: bool) -> TypeTreeBuilder
pub fn has_type_dependencies(self, has_deps: bool) -> TypeTreeBuilder
Set type dependencies flag
Sourcepub fn add_root_node(
&mut self,
node: TypeTreeNode,
) -> Result<&mut TypeTreeBuilder, BinaryError>
pub fn add_root_node( &mut self, node: TypeTreeNode, ) -> Result<&mut TypeTreeBuilder, BinaryError>
Add a root node
Sourcepub fn add_simple_node(
&mut self,
type_name: String,
name: String,
byte_size: i32,
level: i32,
) -> Result<&mut TypeTreeBuilder, BinaryError>
pub fn add_simple_node( &mut self, type_name: String, name: String, byte_size: i32, level: i32, ) -> Result<&mut TypeTreeBuilder, BinaryError>
Create and add a simple node
Sourcepub fn add_child_to_node(
&mut self,
parent_name: &str,
child: TypeTreeNode,
) -> Result<&mut TypeTreeBuilder, BinaryError>
pub fn add_child_to_node( &mut self, parent_name: &str, child: TypeTreeNode, ) -> Result<&mut TypeTreeBuilder, BinaryError>
Add a child node to an existing node
Sourcepub fn add_primitive_field(
&mut self,
parent_name: &str,
field_name: String,
type_name: &str,
) -> Result<&mut TypeTreeBuilder, BinaryError>
pub fn add_primitive_field( &mut self, parent_name: &str, field_name: String, type_name: &str, ) -> Result<&mut TypeTreeBuilder, BinaryError>
Build common primitive types
Sourcepub fn add_array_field(
&mut self,
parent_name: &str,
field_name: String,
element_type: &str,
) -> Result<&mut TypeTreeBuilder, BinaryError>
pub fn add_array_field( &mut self, parent_name: &str, field_name: String, element_type: &str, ) -> Result<&mut TypeTreeBuilder, BinaryError>
Add an array field
Sourcepub fn validate(&self) -> Result<(), BinaryError>
pub fn validate(&self) -> Result<(), BinaryError>
Validate the built TypeTree
Sourcepub fn build(self) -> Result<TypeTree, BinaryError>
pub fn build(self) -> Result<TypeTree, BinaryError>
Build and return the TypeTree
Trait Implementations§
Source§impl Default for TypeTreeBuilder
impl Default for TypeTreeBuilder
Source§fn default() -> TypeTreeBuilder
fn default() -> TypeTreeBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TypeTreeBuilder
impl RefUnwindSafe for TypeTreeBuilder
impl Send for TypeTreeBuilder
impl Sync for TypeTreeBuilder
impl Unpin for TypeTreeBuilder
impl UnwindSafe for TypeTreeBuilder
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
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>
Converts
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>
Converts
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().