9257f5aad0
Implement Copy, Clone, PartialEq and Eq for core::fmt::Alignment Alignment is a fieldless exhaustive enum, so it is already possible to clone and compare it by matching, but it is inconvenient to do so. For example, if one would like to create a struct describing a formatter configuration and provide a clone implementation: ```rust pub struct Format { fill: char, width: Option<usize>, align: fmt::Alignment, } impl Clone for Format { fn clone(&self) -> Self { Format { align: match self.align { fmt::Alignment::Left => fmt::Alignment::Left, fmt::Alignment::Right => fmt::Alignment::Right, fmt::Alignment::Center => fmt::Alignment::Center, }, .. *self } } } ``` Derive Copy, Clone, PartialEq, and Eq for Alignment for convenience. |
||
---|---|---|
.. | ||
alloc | ||
backtrace@b02ed04a7e | ||
core | ||
panic_abort | ||
panic_unwind | ||
portable-simd | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@28335054b1 | ||
test | ||
unwind |