pub struct Partial<'facet, 'shape> { /* private fields */ }Expand description
A work-in-progress heap-allocated value
§Lifetimes
'facet: The lifetime of borrowed values within the structure (or ’static if it’s owned)'shape: The lifetime of the Shape structure itself (often ’static)
Implementations§
Source§impl<'facet, 'shape> Partial<'facet, 'shape>
impl<'facet, 'shape> Partial<'facet, 'shape>
Sourcepub fn alloc_shape(
shape: &'shape Shape<'shape>,
) -> Result<Self, ReflectError<'shape>>
pub fn alloc_shape( shape: &'shape Shape<'shape>, ) -> Result<Self, ReflectError<'shape>>
Allocates a new Partial instance with the given shape
Sourcepub fn alloc<T>() -> Result<TypedPartial<'facet, 'shape, T>, ReflectError<'shape>>where
T: Facet<'facet>,
pub fn alloc<T>() -> Result<TypedPartial<'facet, 'shape, T>, ReflectError<'shape>>where
T: Facet<'facet>,
Allocates a new TypedPartial instance with the given shape and type
Sourcepub fn from_ptr(data: PtrUninit<'_>, shape: &'shape Shape<'shape>) -> Self
pub fn from_ptr(data: PtrUninit<'_>, shape: &'shape Shape<'shape>) -> Self
Creates a Partial from an existing pointer and shape (used for nested initialization)
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Returns the current frame count (depth of nesting)
Sourcepub fn set<U>(&mut self, value: U) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set<U>(&mut self, value: U) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Sets a value wholesale into the current frame
Sourcepub unsafe fn set_shape(
&mut self,
src_value: PtrConst<'_>,
src_shape: &'shape Shape<'shape>,
) -> Result<&mut Self, ReflectError<'shape>>
pub unsafe fn set_shape( &mut self, src_value: PtrConst<'_>, src_shape: &'shape Shape<'shape>, ) -> Result<&mut Self, ReflectError<'shape>>
Sets a value into the current frame by shape, for shape-based operations
If this returns Ok, then src_value has been moved out of
§Safety
The caller must ensure that src_value points to a valid instance of a value
whose memory layout and type matches src_shape, and that this value can be
safely copied (bitwise) into the destination specified by the Partial’s current frame.
No automatic drop will be performed for any existing value, so calling this on an
already-initialized destination may result in leaks or double drops if misused.
After a successful call, the ownership of the value at src_value is effectively moved
into the Partial (i.e., the destination), and the original value should not be used
or dropped by the caller; consider using core::mem::forget on the passed value.
If an error is returned, the destination remains unmodified and safe for future operations.
Sourcepub fn set_default(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn set_default(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Sets the current frame to its default value
Sourcepub fn set_field_default(
&mut self,
field_default_fn: DefaultInPlaceFn,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn set_field_default( &mut self, field_default_fn: DefaultInPlaceFn, ) -> Result<&mut Self, ReflectError<'shape>>
Sets the current frame using a field-level default function
Sourcepub fn set_from_function<F>(
&mut self,
f: F,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn set_from_function<F>( &mut self, f: F, ) -> Result<&mut Self, ReflectError<'shape>>
Sets the current frame using a function that initializes the value
Sourcepub fn parse_from_str(
&mut self,
s: &str,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn parse_from_str( &mut self, s: &str, ) -> Result<&mut Self, ReflectError<'shape>>
Parses a string value into the current frame using the type’s ParseFn from the vtable
Sourcepub fn select_variant_named(
&mut self,
variant_name: &str,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn select_variant_named( &mut self, variant_name: &str, ) -> Result<&mut Self, ReflectError<'shape>>
Pushes a variant for enum initialization by name
Sourcepub fn select_variant(
&mut self,
discriminant: i64,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn select_variant( &mut self, discriminant: i64, ) -> Result<&mut Self, ReflectError<'shape>>
Pushes a variant for enum initialization
Sourcepub fn begin_field(
&mut self,
field_name: &str,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_field( &mut self, field_name: &str, ) -> Result<&mut Self, ReflectError<'shape>>
Selects a field of a struct with a given name
Sourcepub fn select_nth_variant(
&mut self,
index: usize,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn select_nth_variant( &mut self, index: usize, ) -> Result<&mut Self, ReflectError<'shape>>
Selects a variant for enum initialization, by variant index in the enum’s variant list (0-based)
Sourcepub fn begin_nth_field(
&mut self,
idx: usize,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_nth_field( &mut self, idx: usize, ) -> Result<&mut Self, ReflectError<'shape>>
Selects the nth field of a struct by index
Sourcepub fn begin_nth_element(
&mut self,
idx: usize,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_nth_element( &mut self, idx: usize, ) -> Result<&mut Self, ReflectError<'shape>>
Selects the nth element of an array by index
Sourcepub fn begin_nth_enum_field(
&mut self,
idx: usize,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_nth_enum_field( &mut self, idx: usize, ) -> Result<&mut Self, ReflectError<'shape>>
Selects the nth field of an enum variant by index
Sourcepub fn begin_smart_ptr(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_smart_ptr(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Pushes a frame to initialize the inner value of a smart pointer (Box<T>, Arc<T>, etc.)
Sourcepub fn begin_list(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_list(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Begins a pushback operation for a list (Vec, etc.) This initializes the list with default capacity and allows pushing elements
Sourcepub fn begin_map(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_map(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Begins a map initialization operation This initializes the map with default capacity and allows inserting key-value pairs
Sourcepub fn begin_key(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_key(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Pushes a frame for the map key Automatically starts a new insert if we’re idle
Sourcepub fn begin_value(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_value(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Pushes a frame for the map value Must be called after the key has been set and popped
Sourcepub fn begin_list_item(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_list_item(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Pushes an element to the list
The element should be set using set() or similar methods, then pop() to complete
Sourcepub fn end(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn end(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Pops the current frame off the stack, indicating we’re done initializing the current field.
Sourcepub fn build(
&mut self,
) -> Result<HeapValue<'facet, 'shape>, ReflectError<'shape>>
pub fn build( &mut self, ) -> Result<HeapValue<'facet, 'shape>, ReflectError<'shape>>
Builds the value
Sourcepub fn path(&self) -> String
pub fn path(&self) -> String
Returns a human-readable path representing the current traversal in the builder,
e.g., RootStruct.fieldName[index].subfield.
Sourcepub fn innermost_shape(&self) -> &'shape Shape<'shape>
pub fn innermost_shape(&self) -> &'shape Shape<'shape>
Returns the innermost shape (alias for shape(), for compatibility)
Sourcepub fn is_field_set(&self, index: usize) -> Result<bool, ReflectError<'shape>>
pub fn is_field_set(&self, index: usize) -> Result<bool, ReflectError<'shape>>
Check if a struct field at the given index has been set
Sourcepub fn field_index(&self, field_name: &str) -> Option<usize>
pub fn field_index(&self, field_name: &str) -> Option<usize>
Find the index of a field by name in the current struct
Sourcepub fn selected_variant(&self) -> Option<Variant<'shape>>
pub fn selected_variant(&self) -> Option<Variant<'shape>>
Get the currently selected variant for an enum
Sourcepub fn find_variant(
&self,
variant_name: &str,
) -> Option<(usize, &'shape Variant<'shape>)>
pub fn find_variant( &self, variant_name: &str, ) -> Option<(usize, &'shape Variant<'shape>)>
Find a variant by name in the current enum
Sourcepub fn begin_some(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_some(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Begin building the Some variant of an Option
Sourcepub fn begin_inner(&mut self) -> Result<&mut Self, ReflectError<'shape>>
pub fn begin_inner(&mut self) -> Result<&mut Self, ReflectError<'shape>>
Begin building the inner value of a wrapper type
Sourcepub fn set_from_peek(
&mut self,
peek: &Peek<'_, '_, 'shape>,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn set_from_peek( &mut self, peek: &Peek<'_, '_, 'shape>, ) -> Result<&mut Self, ReflectError<'shape>>
Copy a value from a Peek into the current position (safe alternative to set_shape)
Sourcepub fn set_field_from_default(
&mut self,
field_data: PtrConst<'_>,
field_shape: &'shape Shape<'shape>,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn set_field_from_default( &mut self, field_data: PtrConst<'_>, field_shape: &'shape Shape<'shape>, ) -> Result<&mut Self, ReflectError<'shape>>
Copy a field from a struct’s default value (safe wrapper for deserialization) This method creates the Peek internally to avoid exposing unsafe code to callers
Sourcepub fn fill_unset_fields_from_default(
&mut self,
) -> Result<&mut Self, ReflectError<'shape>>
pub fn fill_unset_fields_from_default( &mut self, ) -> Result<&mut Self, ReflectError<'shape>>
Fill all unset fields from the struct’s default value This is a safe API for format deserializers that forbid unsafe code
Sourcepub fn set_nth_element<U>(
&mut self,
idx: usize,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set_nth_element<U>(
&mut self,
idx: usize,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Convenience shortcut: sets the nth element of an array directly to value, popping after.
Sourcepub fn set_nth_field<U>(
&mut self,
idx: usize,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set_nth_field<U>(
&mut self,
idx: usize,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Convenience shortcut: sets the field at index idx directly to value, popping after.
Sourcepub fn set_field<U>(
&mut self,
field_name: &str,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set_field<U>(
&mut self,
field_name: &str,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Convenience shortcut: sets the named field to value, popping after.
Sourcepub fn set_nth_enum_field<U>(
&mut self,
idx: usize,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set_nth_enum_field<U>(
&mut self,
idx: usize,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Convenience shortcut: sets the nth field of an enum variant directly to value, popping after.
Sourcepub fn set_key<U>(
&mut self,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set_key<U>(
&mut self,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Convenience shortcut: sets the key for a map key-value insertion, then pops after.
Sourcepub fn set_value<U>(
&mut self,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn set_value<U>(
&mut self,
value: U,
) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Convenience shortcut: sets the value for a map key-value insertion, then pops after.
Sourcepub fn push<U>(&mut self, value: U) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
pub fn push<U>(&mut self, value: U) -> Result<&mut Self, ReflectError<'shape>>where
U: Facet<'facet>,
Shorthand for: begin_list_item(), set, end
Trait Implementations§
Auto Trait Implementations§
impl<'facet, 'shape> Freeze for Partial<'facet, 'shape>
impl<'facet, 'shape> RefUnwindSafe for Partial<'facet, 'shape>
impl<'facet, 'shape> !Send for Partial<'facet, 'shape>
impl<'facet, 'shape> !Sync for Partial<'facet, 'shape>
impl<'facet, 'shape> Unpin for Partial<'facet, 'shape>
impl<'facet, 'shape> !UnwindSafe for Partial<'facet, 'shape>
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
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more