pub trait TryExtract<A: Access<T>, T>: Access<T> + Sized {
// Required method
fn try_extract(
self,
) -> Result<(A, <A as Access<T>>::RemainderFrom<Self>), Self>;
}Expand description
Trait for runtime checked extraction that may fail.
Returns Ok with (extracted, remainder) on success, or Err with original value on failure.
Most conversions delegate to Extract and always succeed; only Option<T> → T can fail when the value is None.
Required Methods§
Sourcefn try_extract(self) -> Result<(A, <A as Access<T>>::RemainderFrom<Self>), Self>
fn try_extract(self) -> Result<(A, <A as Access<T>>::RemainderFrom<Self>), Self>
Try to extract a value into target type and remainder parts.
§Errors
Returns Err with the original value if the extraction cannot be performed
(e.g., when trying to convert Option<T> to T but the value is None).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".