pub struct CloneIterDebugMap;Expand description
用于克隆后迭代并格式化为调试映射的格式化处理器
这个结构体适配需要克隆才能迭代的集合,使用 debug_map() 方法将其格式化。
§类型参数
Iter: 迭代器类型,必须实现IntoIterator<Item = (K, V)>和CloneK: 键类型,必须实现DebugV: 值类型,必须实现Debug
§示例
use wfu::{FmtBy, CloneIterDebugMap};
let range = (1..4).map(|i| (format!("key{}", i), i * 10));
let proxy = range.fmt_by(CloneIterDebugMap);
assert_eq!(format!("{:?}", proxy), r#"{"key1": 10, "key2": 20, "key3": 30}"#);§注意
- 要求
Iter实现Clone和IntoIterator<Item = (K, V)> - 适用于需要克隆才能迭代的类型,如某些迭代器适配器
Trait Implementations§
Source§impl Clone for CloneIterDebugMap
impl Clone for CloneIterDebugMap
Source§fn clone(&self) -> CloneIterDebugMap
fn clone(&self) -> CloneIterDebugMap
Returns a duplicate of the value. Read more
1.0.0 · 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 CloneIterDebugMap
impl Debug for CloneIterDebugMap
Source§impl Default for CloneIterDebugMap
impl Default for CloneIterDebugMap
Source§fn default() -> CloneIterDebugMap
fn default() -> CloneIterDebugMap
Returns the “default value” for a type. Read more
Source§impl<Iter, K, V> FmtHandler<Iter> for CloneIterDebugMap
impl<Iter, K, V> FmtHandler<Iter> for CloneIterDebugMap
impl Copy for CloneIterDebugMap
Auto Trait Implementations§
impl Freeze for CloneIterDebugMap
impl RefUnwindSafe for CloneIterDebugMap
impl Send for CloneIterDebugMap
impl Sync for CloneIterDebugMap
impl Unpin for CloneIterDebugMap
impl UnwindSafe for CloneIterDebugMap
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