Struct graphql_toolkit_parser::Positioned
source · pub struct Positioned<T>where
T: ?Sized,{
pub pos: Pos,
pub node: T,
}
Expand description
An AST node that stores its original position.
Fields§
§pos: Pos
The position of the node.
node: T
The node itself.
Implementations§
source§impl<T> Positioned<T>
impl<T> Positioned<T>
sourcepub const fn new(node: T, pos: Pos) -> Positioned<T>
pub const fn new(node: T, pos: Pos) -> Positioned<T>
Create a new positioned node from the node and its position.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get the inner node.
This is most useful in callback chains where Positioned::into_inner
is
easier to read than |positioned| positioned.node
.
sourcepub fn position_node<U>(&self, other: U) -> Positioned<U>
pub fn position_node<U>(&self, other: U) -> Positioned<U>
Create a new positioned node with the same position as this one.
sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> Positioned<U>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> Positioned<U>
Map the inner value of this positioned node.
Trait Implementations§
source§impl BorrowMut<str> for Positioned<String>
impl BorrowMut<str> for Positioned<String>
source§fn borrow_mut(&mut self) -> &mut str
fn borrow_mut(&mut self) -> &mut str
Mutably borrows from an owned value. Read more
source§impl<T> Clone for Positioned<T>
impl<T> Clone for Positioned<T>
source§fn clone(&self) -> Positioned<T>
fn clone(&self) -> Positioned<T>
Returns a copy 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<T> Debug for Positioned<T>
impl<T> Debug for Positioned<T>
source§impl<T> Default for Positioned<T>
impl<T> Default for Positioned<T>
source§fn default() -> Positioned<T>
fn default() -> Positioned<T>
Returns the “default value” for a type. Read more
source§impl<'de, T> Deserialize<'de> for Positioned<T>where
T: Deserialize<'de> + ?Sized,
impl<'de, T> Deserialize<'de> for Positioned<T>where
T: Deserialize<'de> + ?Sized,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Positioned<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Positioned<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> Display for Positioned<T>where
T: Display,
impl<T> Display for Positioned<T>where
T: Display,
source§impl<T> Hash for Positioned<T>where
T: Hash,
impl<T> Hash for Positioned<T>where
T: Hash,
source§impl<T> Ord for Positioned<T>where
T: Ord,
impl<T> Ord for Positioned<T>where
T: Ord,
source§fn cmp(&self, other: &Positioned<T>) -> Ordering
fn cmp(&self, other: &Positioned<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T> PartialEq for Positioned<T>where
T: PartialEq,
impl<T> PartialEq for Positioned<T>where
T: PartialEq,
source§fn eq(&self, other: &Positioned<T>) -> bool
fn eq(&self, other: &Positioned<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T> PartialOrd for Positioned<T>where
T: PartialOrd,
impl<T> PartialOrd for Positioned<T>where
T: PartialOrd,
source§fn partial_cmp(&self, other: &Positioned<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Positioned<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T> Serialize for Positioned<T>
impl<T> Serialize for Positioned<T>
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Positioned<T>
impl<T> Eq for Positioned<T>where
T: Eq,
Auto Trait Implementations§
impl<T> Freeze for Positioned<T>
impl<T> RefUnwindSafe for Positioned<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Positioned<T>
impl<T> Sync for Positioned<T>
impl<T> Unpin for Positioned<T>
impl<T> UnwindSafe for Positioned<T>where
T: UnwindSafe + ?Sized,
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
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.