pub fn begin_pointer<'input, const BORROW: bool>(
wip: Partial<'input, BORROW>,
) -> Result<(Partial<'input, BORROW>, PointerAction), DessertError>Expand description
Prepare a smart pointer for deserialization.
This handles the common logic of:
- Detecting string pointers (
Cow<str>,&str,Arc<str>,Box<str>,Rc<str>) which should be handled as scalars - Calling
begin_smart_ptr()for other pointer types - Detecting whether it’s a slice builder or sized pointee
Returns the prepared Partial and an action indicating what the caller should do next.
§Usage
ⓘ
match begin_pointer(wip)? {
(wip, PointerAction::HandleAsScalar) => {
// Handle as scalar/string - set_string_value handles all str pointers
deserialize_scalar(wip)
}
(wip, PointerAction::SliceBuilder) => {
// Arc<[T]>, Box<[T]>, etc - deserialize list items
let wip = deserialize_list(wip)?;
wip.end()
}
(wip, PointerAction::SizedPointee) => {
// Arc<T>, Box<T> - deserialize inner
let wip = deserialize_into(wip)?;
wip.end()
}
}