pub unsafe auto trait Send { }
Expand description
可以跨线程边界传输的类型。
当编译器确定适当时,会自动实现此 trait。
非 Send
类型的一个示例是引用计数指针 rc::Rc
。
如果两个线程试图克隆指向相同引用计数值的 Rc
,它们可能会同时尝试更新引用计数,这是 未定义行为 因为 Rc
不使用原子操作。
它的表亲 sync::Arc
确实使用原子操作 (产生一些开销),因此它是 Send
。
有关更多详细信息,请参见 the Nomicon。
NonNull
指针不是 Send
,因为它们引用的数据可能是别名的。
impl<'a, A> Send for std::option::Iter<'a, A> where
A: Sync,
impl<'a, K> Send for std::collections::hash_set::Drain<'a, K> where
K: Send,
impl<'a, K> Send for std::collections::hash_set::Iter<'a, K> where
K: Sync,
impl<'a, K, V> Send for std::collections::btree_map::Entry<'a, K, V> where
K: Send,
V: Send,
impl<'a, K, V> Send for std::collections::hash_map::Entry<'a, K, V> where
K: Send,
V: Send,
impl<'a, K, V> Send for std::collections::btree_map::Iter<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, K, V> Send for std::collections::btree_map::Keys<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, K, V> Send for std::collections::btree_map::Range<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, K, V> Send for std::collections::btree_map::Values<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, K, V> Send for std::collections::hash_map::Drain<'a, K, V> where
K: Send,
V: Send,
impl<'a, K, V> Send for std::collections::hash_map::Iter<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, K, V> Send for std::collections::hash_map::Keys<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, K, V> Send for std::collections::hash_map::Values<'a, K, V> where
K: Sync,
V: Sync,
impl<'a, T> !Send for std::sync::mpsc::Iter<'a, T>
impl<'a, T> Send for std::collections::binary_heap::Drain<'a, T> where
T: Send,
impl<'a, T> Send for std::collections::binary_heap::Iter<'a, T> where
T: Sync,
impl<'a, T> Send for std::collections::btree_set::Iter<'a, T> where
T: Sync,
impl<'a, T> Send for std::collections::btree_set::Range<'a, T> where
T: Sync,
impl<'a, T> Send for std::collections::btree_set::Union<'a, T> where
T: Sync,
impl<'a, T> Send for std::collections::vec_deque::Iter<'a, T> where
T: Sync,
impl<'a, T> Send for std::result::Iter<'a, T> where
T: Sync,
impl<'a, T, F> !Send for std::collections::linked_list::DrainFilter<'a, T, F>
impl<'a, T, S> Send for std::collections::hash_set::Union<'a, T, S> where
S: Sync,
T: Sync,