1use derive_more::IsVariant;
23/// An enum to represent the state of a [`Cursor`](super::Cursor).
4#[derive(#[automatically_derived]
impl<'a, T: ::core::fmt::Debug> ::core::fmt::Debug for State<'a, T> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
State::Empty => ::core::fmt::Formatter::write_str(f, "Empty"),
State::Head => ::core::fmt::Formatter::write_str(f, "Head"),
State::Tail => ::core::fmt::Formatter::write_str(f, "Tail"),
State::Node(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Node",
&__self_0),
}
}
}Debug, #[automatically_derived]
impl<'a, T: ::core::cmp::PartialEq> ::core::cmp::PartialEq for State<'a, T> {
#[inline]
fn eq(&self, other: &State<'a, T>) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(State::Node(__self_0), State::Node(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl<'a, T: ::core::cmp::Eq> ::core::cmp::Eq for State<'a, T> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<&'a T>;
}
}Eq, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl<'a, T> State<'a, T> {
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Empty"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_empty(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { State::Empty => true, _ => false, }
}
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Head"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_head(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { State::Head => true, _ => false, }
}
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Tail"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_tail(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { State::Tail => true, _ => false, }
}
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Node"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_node(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { State::Node(..) => true, _ => false, }
}
}IsVariant)]
5pub enum State<'a, T> {
6/// The cursor holds an empty list and therefore doesn't point anywhere.
7Empty,
8/// The cursor is pointing to the 'ghost' element before the start of a list.
9Head,
10/// The cursor is pointing to the 'ghost' element after the end of a list.
11Tail,
12/// The cursor is pointing to a Node within the list, containing the borrowed value.
13Node(&'a T),
14}
1516/// An enum to represent the state of a [`Cursor`](super::Cursor) while allowing for mutation.
17#[derive(#[automatically_derived]
impl<'a, T: ::core::fmt::Debug> ::core::fmt::Debug for StateMut<'a, T> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
StateMut::Empty => ::core::fmt::Formatter::write_str(f, "Empty"),
StateMut::Head => ::core::fmt::Formatter::write_str(f, "Head"),
StateMut::Tail => ::core::fmt::Formatter::write_str(f, "Tail"),
StateMut::Node(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Node",
&__self_0),
}
}
}Debug, #[automatically_derived]
impl<'a, T: ::core::cmp::PartialEq> ::core::cmp::PartialEq for StateMut<'a, T>
{
#[inline]
fn eq(&self, other: &StateMut<'a, T>) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(StateMut::Node(__self_0), StateMut::Node(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl<'a, T: ::core::cmp::Eq> ::core::cmp::Eq for StateMut<'a, T> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<&'a mut T>;
}
}Eq, #[allow(deprecated)]
#[allow(unreachable_code)]
#[automatically_derived]
impl<'a, T> StateMut<'a, T> {
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Empty"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_empty(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { StateMut::Empty => true, _ => false, }
}
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Head"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_head(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { StateMut::Head => true, _ => false, }
}
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Tail"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_tail(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { StateMut::Tail => true, _ => false, }
}
#[doc = "Returns `true` if this value is of type `"]
#[doc = "Node"]
#[doc = "`. Returns `false` otherwise"]
#[inline]
#[must_use]
pub const fn is_node(&self) -> bool {
#[allow(non_exhaustive_omitted_patterns)]
match self { StateMut::Node(..) => true, _ => false, }
}
}IsVariant)]
18pub enum StateMut<'a, T> {
19/// The cursor holds an empty list and therefore doesn't point anywhere.
20Empty,
21/// The cursor is pointing to the 'ghost' element before the start of a list.
22Head,
23/// The cursor is pointing to the 'ghost' element after the end of a list.
24Tail,
25/// The cursor is pointing to a Node within the list, containing the mutably borrowed value.
26Node(&'a mut T),
27}