pub enum MatchHandling {
WarnOnly,
Downcast,
BlockOnMatch,
}Expand description
How to handle match expressions on the converted enum
Match expressions cannot be automatically converted because:
- Enum variants become separate types (different concrete types)
- Pattern matching on Box
requires downcast
Variants§
WarnOnly
Emit warnings about match expressions that need manual migration
The match expression is preserved as-is with a TODO comment
Downcast
Attempt to convert match to downcast-based dispatch
ⓘ
// Before:
match status {
Status::Running => { ... }
Status::Stopped => { ... }
}
// After (with appropriate Any impl):
if let Some(running) = status.as_any().downcast_ref::<Running>() {
...
} else if let Some(stopped) = status.as_any().downcast_ref::<Stopped>() {
...
}Requires adding Any bound and as_any() method to trait
BlockOnMatch
Block conversion if any match expression exists
Returns an error with locations of all match expressions
Trait Implementations§
Source§impl Clone for MatchHandling
impl Clone for MatchHandling
Source§fn clone(&self) -> MatchHandling
fn clone(&self) -> MatchHandling
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MatchHandling
impl Debug for MatchHandling
Source§impl Default for MatchHandling
impl Default for MatchHandling
Source§fn default() -> MatchHandling
fn default() -> MatchHandling
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MatchHandling
impl<'de> Deserialize<'de> for MatchHandling
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MatchHandling, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MatchHandling, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for MatchHandling
impl PartialEq for MatchHandling
Source§fn eq(&self, other: &MatchHandling) -> bool
fn eq(&self, other: &MatchHandling) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for MatchHandling
impl Serialize for MatchHandling
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for MatchHandling
impl Eq for MatchHandling
impl StructuralPartialEq for MatchHandling
Auto Trait Implementations§
impl Freeze for MatchHandling
impl RefUnwindSafe for MatchHandling
impl Send for MatchHandling
impl Sync for MatchHandling
impl Unpin for MatchHandling
impl UnsafeUnpin for MatchHandling
impl UnwindSafe for MatchHandling
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more