LazyAggSplay

Struct LazyAggSplay 

Source
pub struct LazyAggSplay<T> {
    _marker: PhantomData<fn() -> T>,
}

Fields§

§_marker: PhantomData<fn() -> T>

Implementations§

Source§

impl<T> LazyAggSplay<T>
where T: LazyMapMonoid,

Source

pub fn update_lazy(node: NodeRef<DataMut<'_>, Self>, lazy: &T::Act)

Examples found in repository?
crates/competitive/src/data_structure/splay_tree/sequence.rs (line 64)
61    fn propagate(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
62        let lazy = replace(&mut node.data_mut().lazy, T::act_unit());
63        if let Some(left) = node.left() {
64            Self::update_lazy(left, &lazy);
65        }
66        if let Some(right) = node.right() {
67            Self::update_lazy(right, &lazy);
68        }
69        if replace(&mut node.data_mut().rev, false) {
70            if let Some(left) = node.left() {
71                Self::reverse(left);
72            }
73            if let Some(right) = node.right() {
74                Self::reverse(right);
75            }
76        }
77        node
78    }
79    fn recalc(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
80        let mut agg = T::single_agg(&node.data().key);
81        let mut size = 1;
82        if let Some(left) = node.left() {
83            let data = left.data();
84            agg = T::agg_operate(&data.agg, &agg);
85            // agg = <T::AggMonoid as Magma>::operate(&data.agg, &agg);
86            size += data.size;
87        }
88        if let Some(right) = node.right() {
89            let data = right.data();
90            agg = T::agg_operate(&agg, &data.agg);
91            size += data.size;
92        }
93        let data = node.data_mut();
94        data.agg = agg;
95        data.size = size;
96        node
97    }
98}
99impl<T> SplaySpec for LazyAggSplay<T>
100where
101    T: LazyMapMonoid,
102{
103    type T = LazyAggElement<T>;
104    fn has_bottom_up() -> bool {
105        true
106    }
107    fn top_down(node: NodeRef<marker::DataMut<'_>, Self>) {
108        Self::propagate(node);
109    }
110    fn bottom_up(node: NodeRef<marker::DataMut<'_>, Self>) {
111        Self::recalc(node);
112    }
113}
114
115struct SeekBySize<T> {
116    index: usize,
117    _marker: PhantomData<fn() -> T>,
118}
119impl<T> SeekBySize<T> {
120    fn new(index: usize) -> Self {
121        Self {
122            index,
123            _marker: PhantomData,
124        }
125    }
126}
127impl<T> SplaySeeker for SeekBySize<T>
128where
129    T: LazyMapMonoid,
130{
131    type S = LazyAggSplay<T>;
132    fn splay_seek(&mut self, node: NodeRef<marker::Immut<'_>, Self::S>) -> Ordering {
133        let lsize = node.left().map(|l| l.data().size).unwrap_or_default();
134        let ord = self.index.cmp(&lsize);
135        if matches!(ord, Ordering::Greater) {
136            self.index -= lsize + 1;
137        }
138        ord
139    }
140}
141
142struct SeekByAccCond<F, T>
143where
144    T: LazyMapMonoid,
145{
146    acc: T::Agg,
147    f: F,
148    _marker: PhantomData<fn() -> T>,
149}
150impl<F, T> SeekByAccCond<F, T>
151where
152    T: LazyMapMonoid,
153{
154    fn new(f: F) -> Self {
155        Self {
156            acc: T::agg_unit(),
157            f,
158            _marker: PhantomData,
159        }
160    }
161}
162impl<F, T> SplaySeeker for SeekByAccCond<F, T>
163where
164    F: FnMut(&T::Agg) -> bool,
165    T: LazyMapMonoid,
166{
167    type S = LazyAggSplay<T>;
168    fn splay_seek(&mut self, node: NodeRef<marker::Immut<'_>, Self::S>) -> Ordering {
169        if let Some(lagg) = node.left().map(|l| &l.data().agg) {
170            let nacc = T::agg_operate(&self.acc, lagg);
171            if (self.f)(&nacc) {
172                return Ordering::Less;
173            }
174            self.acc = nacc;
175        };
176        self.acc = T::agg_operate(&self.acc, &T::single_agg(&node.data().key));
177        if (self.f)(&self.acc) {
178            Ordering::Equal
179        } else {
180            Ordering::Greater
181        }
182    }
183}
184
185struct SeekByRaccCond<F, T>
186where
187    T: LazyMapMonoid,
188{
189    acc: T::Agg,
190    f: F,
191    _marker: PhantomData<fn() -> T>,
192}
193impl<F, T> SeekByRaccCond<F, T>
194where
195    T: LazyMapMonoid,
196{
197    fn new(f: F) -> Self {
198        Self {
199            acc: T::agg_unit(),
200            f,
201            _marker: PhantomData,
202        }
203    }
204}
205impl<F, T> SplaySeeker for SeekByRaccCond<F, T>
206where
207    F: FnMut(&T::Agg) -> bool,
208    T: LazyMapMonoid,
209{
210    type S = LazyAggSplay<T>;
211    fn splay_seek(&mut self, node: NodeRef<marker::Immut<'_>, Self::S>) -> Ordering {
212        if let Some(lagg) = node.right().map(|r| &r.data().agg) {
213            let nacc = T::agg_operate(lagg, &self.acc);
214            if (self.f)(&nacc) {
215                return Ordering::Greater;
216            }
217            self.acc = nacc;
218        };
219        self.acc = T::agg_operate(&T::single_agg(&node.data().key), &self.acc);
220        if (self.f)(&self.acc) {
221            Ordering::Equal
222        } else {
223            Ordering::Less
224        }
225    }
226}
227
228pub struct SplaySequence<T, A = MemoryPool<Node<LazyAggElement<T>>>>
229where
230    T: LazyMapMonoid,
231    A: Allocator<Node<LazyAggElement<T>>>,
232{
233    root: Root<LazyAggSplay<T>>,
234    length: usize,
235    alloc: ManuallyDrop<A>,
236}
237
238impl<T, A> Debug for SplaySequence<T, A>
239where
240    T: LazyMapMonoid<Key: Debug, Agg: Debug, Act: Debug>,
241    A: Allocator<Node<LazyAggElement<T>>>,
242{
243    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
244        f.debug_struct("SplayMap")
245            .field("root", &self.root)
246            .field("length", &self.length)
247            .finish()
248    }
249}
250
251impl<T, A> Drop for SplaySequence<T, A>
252where
253    T: LazyMapMonoid,
254    A: Allocator<Node<LazyAggElement<T>>>,
255{
256    fn drop(&mut self) {
257        unsafe {
258            while let Some(node) = self.root.take_first() {
259                self.alloc.deallocate(node.into_dying().into_inner());
260            }
261            ManuallyDrop::drop(&mut self.alloc);
262        }
263    }
264}
265
266impl<T, A> Default for SplaySequence<T, A>
267where
268    T: LazyMapMonoid,
269    A: Allocator<Node<LazyAggElement<T>>> + Default,
270{
271    fn default() -> Self {
272        Self {
273            root: Root::default(),
274            length: 0,
275            alloc: Default::default(),
276        }
277    }
278}
279
280impl<T> SplaySequence<T>
281where
282    T: LazyMapMonoid,
283{
284    pub fn new() -> Self {
285        Default::default()
286    }
287    pub fn with_capacity(capacity: usize) -> Self {
288        Self {
289            root: Root::default(),
290            length: 0,
291            alloc: ManuallyDrop::new(MemoryPool::with_capacity(capacity)),
292        }
293    }
294    pub fn len(&self) -> usize {
295        self.length
296    }
297    pub fn is_empty(&self) -> bool {
298        self.length == 0
299    }
300}
301impl<T, A> SplaySequence<T, A>
302where
303    T: LazyMapMonoid,
304    A: Allocator<Node<LazyAggElement<T>>>,
305{
306    fn range<R>(&mut self, range: R) -> NodeRange<'_, LazyAggSplay<T>>
307    where
308        R: RangeBounds<usize>,
309    {
310        let start = match range.start_bound() {
311            Bound::Included(&index) => Bound::Included(SeekBySize::new(index)),
312            Bound::Excluded(&index) => Bound::Excluded(SeekBySize::new(index)),
313            Bound::Unbounded => Bound::Unbounded,
314        };
315        let end = match range.end_bound() {
316            Bound::Included(&index) => Bound::Included(SeekBySize::new(index)),
317            Bound::Excluded(&index) => Bound::Excluded(SeekBySize::new(index)),
318            Bound::Unbounded => Bound::Unbounded,
319        };
320        self.root.range(start, end)
321    }
322    pub fn update<R>(&mut self, range: R, x: T::Act)
323    where
324        R: RangeBounds<usize>,
325    {
326        if let Some(root) = self.range(range).root_mut().root_data_mut() {
327            LazyAggSplay::<T>::update_lazy(root, &x);
328        }
329    }
Source

pub fn reverse(node: NodeRef<DataMut<'_>, Self>)

Examples found in repository?
crates/competitive/src/data_structure/splay_tree/sequence.rs (line 71)
61    fn propagate(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
62        let lazy = replace(&mut node.data_mut().lazy, T::act_unit());
63        if let Some(left) = node.left() {
64            Self::update_lazy(left, &lazy);
65        }
66        if let Some(right) = node.right() {
67            Self::update_lazy(right, &lazy);
68        }
69        if replace(&mut node.data_mut().rev, false) {
70            if let Some(left) = node.left() {
71                Self::reverse(left);
72            }
73            if let Some(right) = node.right() {
74                Self::reverse(right);
75            }
76        }
77        node
78    }
79    fn recalc(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
80        let mut agg = T::single_agg(&node.data().key);
81        let mut size = 1;
82        if let Some(left) = node.left() {
83            let data = left.data();
84            agg = T::agg_operate(&data.agg, &agg);
85            // agg = <T::AggMonoid as Magma>::operate(&data.agg, &agg);
86            size += data.size;
87        }
88        if let Some(right) = node.right() {
89            let data = right.data();
90            agg = T::agg_operate(&agg, &data.agg);
91            size += data.size;
92        }
93        let data = node.data_mut();
94        data.agg = agg;
95        data.size = size;
96        node
97    }
98}
99impl<T> SplaySpec for LazyAggSplay<T>
100where
101    T: LazyMapMonoid,
102{
103    type T = LazyAggElement<T>;
104    fn has_bottom_up() -> bool {
105        true
106    }
107    fn top_down(node: NodeRef<marker::DataMut<'_>, Self>) {
108        Self::propagate(node);
109    }
110    fn bottom_up(node: NodeRef<marker::DataMut<'_>, Self>) {
111        Self::recalc(node);
112    }
113}
114
115struct SeekBySize<T> {
116    index: usize,
117    _marker: PhantomData<fn() -> T>,
118}
119impl<T> SeekBySize<T> {
120    fn new(index: usize) -> Self {
121        Self {
122            index,
123            _marker: PhantomData,
124        }
125    }
126}
127impl<T> SplaySeeker for SeekBySize<T>
128where
129    T: LazyMapMonoid,
130{
131    type S = LazyAggSplay<T>;
132    fn splay_seek(&mut self, node: NodeRef<marker::Immut<'_>, Self::S>) -> Ordering {
133        let lsize = node.left().map(|l| l.data().size).unwrap_or_default();
134        let ord = self.index.cmp(&lsize);
135        if matches!(ord, Ordering::Greater) {
136            self.index -= lsize + 1;
137        }
138        ord
139    }
140}
141
142struct SeekByAccCond<F, T>
143where
144    T: LazyMapMonoid,
145{
146    acc: T::Agg,
147    f: F,
148    _marker: PhantomData<fn() -> T>,
149}
150impl<F, T> SeekByAccCond<F, T>
151where
152    T: LazyMapMonoid,
153{
154    fn new(f: F) -> Self {
155        Self {
156            acc: T::agg_unit(),
157            f,
158            _marker: PhantomData,
159        }
160    }
161}
162impl<F, T> SplaySeeker for SeekByAccCond<F, T>
163where
164    F: FnMut(&T::Agg) -> bool,
165    T: LazyMapMonoid,
166{
167    type S = LazyAggSplay<T>;
168    fn splay_seek(&mut self, node: NodeRef<marker::Immut<'_>, Self::S>) -> Ordering {
169        if let Some(lagg) = node.left().map(|l| &l.data().agg) {
170            let nacc = T::agg_operate(&self.acc, lagg);
171            if (self.f)(&nacc) {
172                return Ordering::Less;
173            }
174            self.acc = nacc;
175        };
176        self.acc = T::agg_operate(&self.acc, &T::single_agg(&node.data().key));
177        if (self.f)(&self.acc) {
178            Ordering::Equal
179        } else {
180            Ordering::Greater
181        }
182    }
183}
184
185struct SeekByRaccCond<F, T>
186where
187    T: LazyMapMonoid,
188{
189    acc: T::Agg,
190    f: F,
191    _marker: PhantomData<fn() -> T>,
192}
193impl<F, T> SeekByRaccCond<F, T>
194where
195    T: LazyMapMonoid,
196{
197    fn new(f: F) -> Self {
198        Self {
199            acc: T::agg_unit(),
200            f,
201            _marker: PhantomData,
202        }
203    }
204}
205impl<F, T> SplaySeeker for SeekByRaccCond<F, T>
206where
207    F: FnMut(&T::Agg) -> bool,
208    T: LazyMapMonoid,
209{
210    type S = LazyAggSplay<T>;
211    fn splay_seek(&mut self, node: NodeRef<marker::Immut<'_>, Self::S>) -> Ordering {
212        if let Some(lagg) = node.right().map(|r| &r.data().agg) {
213            let nacc = T::agg_operate(lagg, &self.acc);
214            if (self.f)(&nacc) {
215                return Ordering::Greater;
216            }
217            self.acc = nacc;
218        };
219        self.acc = T::agg_operate(&T::single_agg(&node.data().key), &self.acc);
220        if (self.f)(&self.acc) {
221            Ordering::Equal
222        } else {
223            Ordering::Less
224        }
225    }
226}
227
228pub struct SplaySequence<T, A = MemoryPool<Node<LazyAggElement<T>>>>
229where
230    T: LazyMapMonoid,
231    A: Allocator<Node<LazyAggElement<T>>>,
232{
233    root: Root<LazyAggSplay<T>>,
234    length: usize,
235    alloc: ManuallyDrop<A>,
236}
237
238impl<T, A> Debug for SplaySequence<T, A>
239where
240    T: LazyMapMonoid<Key: Debug, Agg: Debug, Act: Debug>,
241    A: Allocator<Node<LazyAggElement<T>>>,
242{
243    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
244        f.debug_struct("SplayMap")
245            .field("root", &self.root)
246            .field("length", &self.length)
247            .finish()
248    }
249}
250
251impl<T, A> Drop for SplaySequence<T, A>
252where
253    T: LazyMapMonoid,
254    A: Allocator<Node<LazyAggElement<T>>>,
255{
256    fn drop(&mut self) {
257        unsafe {
258            while let Some(node) = self.root.take_first() {
259                self.alloc.deallocate(node.into_dying().into_inner());
260            }
261            ManuallyDrop::drop(&mut self.alloc);
262        }
263    }
264}
265
266impl<T, A> Default for SplaySequence<T, A>
267where
268    T: LazyMapMonoid,
269    A: Allocator<Node<LazyAggElement<T>>> + Default,
270{
271    fn default() -> Self {
272        Self {
273            root: Root::default(),
274            length: 0,
275            alloc: Default::default(),
276        }
277    }
278}
279
280impl<T> SplaySequence<T>
281where
282    T: LazyMapMonoid,
283{
284    pub fn new() -> Self {
285        Default::default()
286    }
287    pub fn with_capacity(capacity: usize) -> Self {
288        Self {
289            root: Root::default(),
290            length: 0,
291            alloc: ManuallyDrop::new(MemoryPool::with_capacity(capacity)),
292        }
293    }
294    pub fn len(&self) -> usize {
295        self.length
296    }
297    pub fn is_empty(&self) -> bool {
298        self.length == 0
299    }
300}
301impl<T, A> SplaySequence<T, A>
302where
303    T: LazyMapMonoid,
304    A: Allocator<Node<LazyAggElement<T>>>,
305{
306    fn range<R>(&mut self, range: R) -> NodeRange<'_, LazyAggSplay<T>>
307    where
308        R: RangeBounds<usize>,
309    {
310        let start = match range.start_bound() {
311            Bound::Included(&index) => Bound::Included(SeekBySize::new(index)),
312            Bound::Excluded(&index) => Bound::Excluded(SeekBySize::new(index)),
313            Bound::Unbounded => Bound::Unbounded,
314        };
315        let end = match range.end_bound() {
316            Bound::Included(&index) => Bound::Included(SeekBySize::new(index)),
317            Bound::Excluded(&index) => Bound::Excluded(SeekBySize::new(index)),
318            Bound::Unbounded => Bound::Unbounded,
319        };
320        self.root.range(start, end)
321    }
322    pub fn update<R>(&mut self, range: R, x: T::Act)
323    where
324        R: RangeBounds<usize>,
325    {
326        if let Some(root) = self.range(range).root_mut().root_data_mut() {
327            LazyAggSplay::<T>::update_lazy(root, &x);
328        }
329    }
330    pub fn fold<R>(&mut self, range: R) -> T::Agg
331    where
332        R: RangeBounds<usize>,
333    {
334        if let Some(root) = self.range(range).root().root() {
335            root.data().agg.clone()
336        } else {
337            T::agg_unit()
338        }
339    }
340    pub fn reverse<R>(&mut self, range: R)
341    where
342        R: RangeBounds<usize>,
343    {
344        if let Some(root) = self.range(range).root_mut().root_data_mut() {
345            LazyAggSplay::<T>::reverse(root);
346        }
347    }
Source

fn propagate(node: NodeRef<DataMut<'_>, Self>) -> NodeRef<DataMut<'_>, Self>

Examples found in repository?
crates/competitive/src/data_structure/splay_tree/sequence.rs (line 52)
46    pub fn update_lazy(mut node: NodeRef<marker::DataMut<'_>, Self>, lazy: &T::Act) {
47        T::act_operate_assign(&mut node.data_mut().lazy, lazy);
48        node.data_mut().key = T::act_key(&node.data().key, lazy);
49        if let Some(nxlazy) = T::act_agg(&node.data().agg, lazy) {
50            node.data_mut().agg = nxlazy;
51        } else {
52            node = Self::propagate(node);
53            Self::recalc(node);
54        }
55    }
56    pub fn reverse(node: NodeRef<marker::DataMut<'_>, Self>) {
57        node.reverse();
58        T::toggle(&mut node.data_mut().agg);
59        node.data_mut().rev ^= true;
60    }
61    fn propagate(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
62        let lazy = replace(&mut node.data_mut().lazy, T::act_unit());
63        if let Some(left) = node.left() {
64            Self::update_lazy(left, &lazy);
65        }
66        if let Some(right) = node.right() {
67            Self::update_lazy(right, &lazy);
68        }
69        if replace(&mut node.data_mut().rev, false) {
70            if let Some(left) = node.left() {
71                Self::reverse(left);
72            }
73            if let Some(right) = node.right() {
74                Self::reverse(right);
75            }
76        }
77        node
78    }
79    fn recalc(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
80        let mut agg = T::single_agg(&node.data().key);
81        let mut size = 1;
82        if let Some(left) = node.left() {
83            let data = left.data();
84            agg = T::agg_operate(&data.agg, &agg);
85            // agg = <T::AggMonoid as Magma>::operate(&data.agg, &agg);
86            size += data.size;
87        }
88        if let Some(right) = node.right() {
89            let data = right.data();
90            agg = T::agg_operate(&agg, &data.agg);
91            size += data.size;
92        }
93        let data = node.data_mut();
94        data.agg = agg;
95        data.size = size;
96        node
97    }
98}
99impl<T> SplaySpec for LazyAggSplay<T>
100where
101    T: LazyMapMonoid,
102{
103    type T = LazyAggElement<T>;
104    fn has_bottom_up() -> bool {
105        true
106    }
107    fn top_down(node: NodeRef<marker::DataMut<'_>, Self>) {
108        Self::propagate(node);
109    }
Source

fn recalc(node: NodeRef<DataMut<'_>, Self>) -> NodeRef<DataMut<'_>, Self>

Examples found in repository?
crates/competitive/src/data_structure/splay_tree/sequence.rs (line 53)
46    pub fn update_lazy(mut node: NodeRef<marker::DataMut<'_>, Self>, lazy: &T::Act) {
47        T::act_operate_assign(&mut node.data_mut().lazy, lazy);
48        node.data_mut().key = T::act_key(&node.data().key, lazy);
49        if let Some(nxlazy) = T::act_agg(&node.data().agg, lazy) {
50            node.data_mut().agg = nxlazy;
51        } else {
52            node = Self::propagate(node);
53            Self::recalc(node);
54        }
55    }
56    pub fn reverse(node: NodeRef<marker::DataMut<'_>, Self>) {
57        node.reverse();
58        T::toggle(&mut node.data_mut().agg);
59        node.data_mut().rev ^= true;
60    }
61    fn propagate(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
62        let lazy = replace(&mut node.data_mut().lazy, T::act_unit());
63        if let Some(left) = node.left() {
64            Self::update_lazy(left, &lazy);
65        }
66        if let Some(right) = node.right() {
67            Self::update_lazy(right, &lazy);
68        }
69        if replace(&mut node.data_mut().rev, false) {
70            if let Some(left) = node.left() {
71                Self::reverse(left);
72            }
73            if let Some(right) = node.right() {
74                Self::reverse(right);
75            }
76        }
77        node
78    }
79    fn recalc(node: NodeRef<marker::DataMut<'_>, Self>) -> NodeRef<marker::DataMut<'_>, Self> {
80        let mut agg = T::single_agg(&node.data().key);
81        let mut size = 1;
82        if let Some(left) = node.left() {
83            let data = left.data();
84            agg = T::agg_operate(&data.agg, &agg);
85            // agg = <T::AggMonoid as Magma>::operate(&data.agg, &agg);
86            size += data.size;
87        }
88        if let Some(right) = node.right() {
89            let data = right.data();
90            agg = T::agg_operate(&agg, &data.agg);
91            size += data.size;
92        }
93        let data = node.data_mut();
94        data.agg = agg;
95        data.size = size;
96        node
97    }
98}
99impl<T> SplaySpec for LazyAggSplay<T>
100where
101    T: LazyMapMonoid,
102{
103    type T = LazyAggElement<T>;
104    fn has_bottom_up() -> bool {
105        true
106    }
107    fn top_down(node: NodeRef<marker::DataMut<'_>, Self>) {
108        Self::propagate(node);
109    }
110    fn bottom_up(node: NodeRef<marker::DataMut<'_>, Self>) {
111        Self::recalc(node);
112    }

Trait Implementations§

Auto Trait Implementations§

§

impl<T> Freeze for LazyAggSplay<T>

§

impl<T> RefUnwindSafe for LazyAggSplay<T>

§

impl<T> Send for LazyAggSplay<T>

§

impl<T> Sync for LazyAggSplay<T>

§

impl<T> Unpin for LazyAggSplay<T>

§

impl<T> UnwindSafe for LazyAggSplay<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.