pub struct Repeated<T>where
T: Display,{
pub value: T,
pub count: usize,
}
Expand description
Note: only the Display impl is special; the Debug impl is just a #[derive]
.
Use https://crates.io/crates/fmt_adapter if this is an issue.
use fmt_utils::std::Repeated;
assert_eq!(Repeated { value: "", count: 0 }.to_string(), "");
assert_eq!(Repeated { value: 'a', count: 0 }.to_string(), "");
assert_eq!(Repeated { value: "ab", count: 0 }.to_string(), "");
assert_eq!(Repeated { value: "", count: 1 }.to_string(), "");
assert_eq!(Repeated { value: 'a', count: 1 }.to_string(), "a");
assert_eq!(Repeated { value: "ab", count: 1 }.to_string(), "ab");
assert_eq!(Repeated { value: "", count: 2 }.to_string(), "");
assert_eq!(Repeated { value: 'a', count: 2 }.to_string(), "aa");
assert_eq!(Repeated { value: "ab", count: 2 }.to_string(), "abab");
Fields§
§value: T
§count: usize
Trait Implementations§
impl<T> Copy for Repeated<T>
Auto Trait Implementations§
impl<T> Freeze for Repeated<T>where
T: Freeze,
impl<T> RefUnwindSafe for Repeated<T>where
T: RefUnwindSafe,
impl<T> Send for Repeated<T>where
T: Send,
impl<T> Sync for Repeated<T>where
T: Sync,
impl<T> Unpin for Repeated<T>where
T: Unpin,
impl<T> UnwindSafe for Repeated<T>where
T: UnwindSafe,
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