Skip to main content

try_as_dyn_mut

Function try_as_dyn_mut 

Source
pub const fn try_as_dyn_mut<'a, T, U>(t: &mut T) -> Option<&mut U>
where T: 'a + ?Sized, U: TryAsDynCompatible<'a> + ?Sized,
🔬This is a nightly-only experimental API. (try_as_dyn #144361)
Expand description

Returns Some(&mut U) if T can be coerced to the trait object type U. Otherwise, it returns None.

See documentation of try_as_dyn for details about the behaviour and limitations.