Struct async_graphql_parser::Positioned
source · pub struct Positioned<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 + ?Sized> Clone for Positioned<T>
impl<T: Clone + ?Sized> 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: Default + ?Sized> Default for Positioned<T>
impl<T: Default + ?Sized> 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: Display> Display for Positioned<T>
impl<T: Display> Display for Positioned<T>
source§impl<T: Hash> Hash for Positioned<T>
impl<T: Hash> Hash for Positioned<T>
source§impl<T: Ord> Ord for Positioned<T>
impl<T: Ord> Ord for Positioned<T>
source§impl<T: PartialEq> PartialEq for Positioned<T>
impl<T: PartialEq> PartialEq for Positioned<T>
source§impl<T: PartialOrd> PartialOrd for Positioned<T>
impl<T: PartialOrd> PartialOrd for Positioned<T>
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 moreimpl<T: Copy + ?Sized> Copy for Positioned<T>
impl<T: Eq> Eq for Positioned<T>
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for Positioned<T>where T: RefUnwindSafe,
impl<T: ?Sized> Send for Positioned<T>where T: Send,
impl<T: ?Sized> Sync for Positioned<T>where T: Sync,
impl<T: ?Sized> Unpin for Positioned<T>where T: Unpin,
impl<T: ?Sized> UnwindSafe for Positioned<T>where T: UnwindSafe,
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.