[−][src]Struct nom_locate::LocatedSpan
A LocatedSpan is a set of meta information about the location of a token, including extra information.
The LocatedSpan
structure can be used as an input of the nom parsers.
It implements all the necessary traits for LocatedSpan<&str,X>
and LocatedSpan<&[u8],X>
Fields
extra: X
Extra information that can be embedded by the user. Example: the parsed file name
Implementations
impl<T: AsBytes> LocatedSpan<T, ()>
[src]
pub fn new(program: T) -> LocatedSpan<T, ()>
[src]
Create a span for a particular input with default offset
and
line
values and empty extra data.
You can compute the column through the get_column
or get_utf8_column
methods.
offset
starts at 0, line
starts at 1, and column
starts at 1.
Do not use this constructor in parser functions; nom
and
nom_locate
assume span offsets are relative to the beginning of the
same input. In these cases, you probably want to use the
nom::traits::Slice
trait instead.
Example of use
use nom_locate::LocatedSpan; let span = LocatedSpan::new(b"foobar"); assert_eq!(span.location_offset(), 0); assert_eq!(span.location_line(), 1); assert_eq!(span.get_column(), 1); assert_eq!(span.fragment(), &&b"foobar"[..]);
impl<T: AsBytes, X> LocatedSpan<T, X>
[src]
pub fn new_extra(program: T, extra: X) -> LocatedSpan<T, X>
[src]
Create a span for a particular input with default offset
and
line
values. You can compute the column through the get_column
or get_utf8_column
methods.
offset
starts at 0, line
starts at 1, and column
starts at 1.
Do not use this constructor in parser functions; nom
and
nom_locate
assume span offsets are relative to the beginning of the
same input. In these cases, you probably want to use the
nom::traits::Slice
trait instead.
Example of use
use nom_locate::LocatedSpan; let span = LocatedSpan::new_extra(b"foobar", "extra"); assert_eq!(span.location_offset(), 0); assert_eq!(span.location_line(), 1); assert_eq!(span.get_column(), 1); assert_eq!(span.fragment(), &&b"foobar"[..]); assert_eq!(span.extra, "extra");
pub unsafe fn new_from_raw_offset(
offset: usize,
line: u32,
fragment: T,
extra: X
) -> LocatedSpan<T, X>
[src]
offset: usize,
line: u32,
fragment: T,
extra: X
) -> LocatedSpan<T, X>
Similar to new_extra
, but allows overriding offset and line.
This is unsafe, because giving an offset too large may result in
undefined behavior, as some methods move back along the fragment
assuming any negative index within the offset is valid.
pub fn location_offset(&self) -> usize
[src]
The offset represents the position of the fragment relatively to the input of the parser. It starts at offset 0.
pub fn location_line(&self) -> u32
[src]
The line number of the fragment relatively to the input of the parser. It starts at line 1.
pub fn fragment(&self) -> &T
[src]
The fragment that is spanned. The fragment represents a part of the input of the parser.
pub fn get_line_beginning(&self) -> &[u8]ⓘ
[src]
Return the line that contains this LocatedSpan.
The get_column
and get_utf8_column
functions returns
indexes that corresponds to the line returned by this function.
Note that if this LocatedSpan ends before the end of the
original data, the result of calling get_line_beginning()
will not include any data from after the LocatedSpan.
let program = LocatedSpan::new( "Hello World!\ \nThis is a multi-line input\ \nthat ends after this line.\n"); let multi = program.find_substring("multi").unwrap(); assert_eq!( program.slice(multi..).get_line_beginning(), "This is a multi-line input".as_bytes(), );
pub fn get_column(&self) -> usize
[src]
Return the column index, assuming 1 byte = 1 column.
Use it for ascii text, or use get_utf8_column for UTF8.
Example of use
let span = LocatedSpan::new("foobar"); assert_eq!(span.slice(3..).get_column(), 4);
pub fn get_utf8_column(&self) -> usize
[src]
Return the column index for UTF8 text. Return value is unspecified for non-utf8 text.
This version uses bytecount's hyper algorithm to count characters. This is much faster
for long lines, but is non-negligibly slower for short slices (below around 100 bytes).
This is also sped up significantly more depending on architecture and enabling the simd
feature gates. If you expect primarily short lines, you may get a noticeable speedup in
parsing by using naive_get_utf8_column
instead. Benchmark your specific use case!
Example of use
let span = LocatedSpan::new("メカジキ"); let indexOf3dKanji = span.find_substring("ジ").unwrap(); assert_eq!(span.slice(indexOf3dKanji..).get_column(), 7); assert_eq!(span.slice(indexOf3dKanji..).get_utf8_column(), 3);
pub fn naive_get_utf8_column(&self) -> usize
[src]
Return the column index for UTF8 text. Return value is unspecified for non-utf8 text.
A simpler implementation of get_utf8_column
that may be faster on shorter lines.
If benchmarking shows that this is faster, you can use it instead of get_utf8_column
.
Prefer defaulting to get_utf8_column
unless this legitimately is a performance bottleneck.
Example of use
let span = LocatedSpan::new("メカジキ"); let indexOf3dKanji = span.find_substring("ジ").unwrap(); assert_eq!(span.slice(indexOf3dKanji..).get_column(), 7); assert_eq!(span.slice(indexOf3dKanji..).naive_get_utf8_column(), 3);
Trait Implementations
impl<T: AsBytes, X> AsBytes for LocatedSpan<T, X>
[src]
impl<T: Clone, X: Clone> Clone for LocatedSpan<T, X>
[src]
pub fn clone(&self) -> LocatedSpan<T, X>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<A: Compare<B>, B: Into<LocatedSpan<B>>, X> Compare<B> for LocatedSpan<A, X>
[src]
pub fn compare(&self, t: B) -> CompareResult
[src]
pub fn compare_no_case(&self, t: B) -> CompareResult
[src]
impl<T: Copy, X: Copy> Copy for LocatedSpan<T, X>
[src]
impl<T: Debug, X: Debug> Debug for LocatedSpan<T, X>
[src]
impl<T, X> Deref for LocatedSpan<T, X>
[src]
impl<T: ToString, X> Display for LocatedSpan<T, X>
[src]
impl<T: AsBytes + Eq, X> Eq for LocatedSpan<T, X>
[src]
impl<'a, X> ExtendInto for LocatedSpan<&'a str, X>
[src]
type Item = char
The current input type is a sequence of that Item
type. Read more
type Extender = String
The type that will be produced
pub fn new_builder(&self) -> Self::Extender
[src]
pub fn extend_into(&self, acc: &mut Self::Extender)
[src]
impl<'a, X> ExtendInto for LocatedSpan<&'a [u8], X>
[src]
type Item = u8
The current input type is a sequence of that Item
type. Read more
type Extender = Vec<u8>
The type that will be produced
pub fn new_builder(&self) -> Self::Extender
[src]
pub fn extend_into(&self, acc: &mut Self::Extender)
[src]
impl<'a, T, X> FindSubstring<&'a str> for LocatedSpan<T, X> where
T: FindSubstring<&'a str>,
[src]
T: FindSubstring<&'a str>,
pub fn find_substring(&self, substr: &'a str) -> Option<usize>
[src]
impl<Fragment: FindToken<Token>, Token, X> FindToken<Token> for LocatedSpan<Fragment, X>
[src]
pub fn find_token(&self, token: Token) -> bool
[src]
impl<T: AsBytes, X: Default> From<T> for LocatedSpan<T, X>
[src]
impl<T: Hash, X> Hash for LocatedSpan<T, X>
[src]
pub fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, X> InputIter for LocatedSpan<&'a str, X>
[src]
type Item = char
The current input type is a sequence of that Item
type. Read more
type Iter = CharIndices<'a>
An iterator over the input type, producing the item and its position
for use with Slice. If we're iterating over &str
, the position
corresponds to the byte index of the character Read more
type IterElem = Chars<'a>
An iterator over the input type, producing the item
pub fn iter_indices(&self) -> Self::Iter
[src]
pub fn iter_elements(&self) -> Self::IterElem
[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
[src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>
[src]
impl<'a, X> InputIter for LocatedSpan<&'a [u8], X>
[src]
type Item = u8
The current input type is a sequence of that Item
type. Read more
type Iter = Enumerate<Self::IterElem>
An iterator over the input type, producing the item and its position
for use with Slice. If we're iterating over &str
, the position
corresponds to the byte index of the character Read more
type IterElem = Copied<Iter<'a, Self::Item>>
An iterator over the input type, producing the item
pub fn iter_indices(&self) -> Self::Iter
[src]
pub fn iter_elements(&self) -> Self::IterElem
[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
[src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>
[src]
impl<T: InputLength, X> InputLength for LocatedSpan<T, X>
[src]
impl<T, X> InputTake for LocatedSpan<T, X> where
Self: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>>,
[src]
Self: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>>,
pub fn take(&self, count: usize) -> Self
[src]
pub fn take_split(&self, count: usize) -> (Self, Self)
[src]
impl<T, X> InputTakeAtPosition for LocatedSpan<T, X> where
T: InputTakeAtPosition + InputLength + InputIter,
Self: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>> + Clone,
[src]
T: InputTakeAtPosition + InputLength + InputIter,
Self: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>> + Clone,
type Item = <T as InputIter>::Item
The current input type is a sequence of that Item
type. Read more
pub fn split_at_position_complete<P, E: ParseError<Self>>(
&self,
predicate: P
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
[src]
&self,
predicate: P
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
pub fn split_at_position<P, E: ParseError<Self>>(
&self,
predicate: P
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
[src]
&self,
predicate: P
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
pub fn split_at_position1<P, E: ParseError<Self>>(
&self,
predicate: P,
e: ErrorKind
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
[src]
&self,
predicate: P,
e: ErrorKind
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
pub fn split_at_position1_complete<P, E: ParseError<Self>>(
&self,
predicate: P,
e: ErrorKind
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
[src]
&self,
predicate: P,
e: ErrorKind
) -> IResult<Self, Self, E> where
P: Fn(Self::Item) -> bool,
impl<T, X> Offset for LocatedSpan<T, X>
[src]
impl<R: FromStr, T, X> ParseTo<R> for LocatedSpan<T, X> where
T: ParseTo<R>,
[src]
T: ParseTo<R>,
impl<T: AsBytes + PartialEq, X> PartialEq<LocatedSpan<T, X>> for LocatedSpan<T, X>
[src]
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, X: Clone> Slice<Range<usize>> for LocatedSpan<&'a str, X>
[src]
impl<'a, X: Clone> Slice<Range<usize>> for LocatedSpan<&'a [u8], X>
[src]
impl<'a, X: Clone> Slice<RangeFrom<usize>> for LocatedSpan<&'a str, X>
[src]
impl<'a, X: Clone> Slice<RangeFrom<usize>> for LocatedSpan<&'a [u8], X>
[src]
impl<'a, X: Clone> Slice<RangeFull> for LocatedSpan<&'a str, X>
[src]
impl<'a, X: Clone> Slice<RangeFull> for LocatedSpan<&'a [u8], X>
[src]
impl<'a, X: Clone> Slice<RangeTo<usize>> for LocatedSpan<&'a str, X>
[src]
impl<'a, X: Clone> Slice<RangeTo<usize>> for LocatedSpan<&'a [u8], X>
[src]
Auto Trait Implementations
impl<T, X> RefUnwindSafe for LocatedSpan<T, X> where
T: RefUnwindSafe,
X: RefUnwindSafe,
T: RefUnwindSafe,
X: RefUnwindSafe,
impl<T, X> Send for LocatedSpan<T, X> where
T: Send,
X: Send,
T: Send,
X: Send,
impl<T, X> Sync for LocatedSpan<T, X> where
T: Sync,
X: Sync,
T: Sync,
X: Sync,
impl<T, X> Unpin for LocatedSpan<T, X> where
T: Unpin,
X: Unpin,
T: Unpin,
X: Unpin,
impl<T, X> UnwindSafe for LocatedSpan<T, X> where
T: UnwindSafe,
X: UnwindSafe,
T: UnwindSafe,
X: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Conv for T
impl<T> Conv for T
impl<T> FmtForward for T
pub fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Self: Binary,
pub fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Self: Display,
pub fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Self: LowerExp,
pub fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Self: LowerHex,
pub fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Self: Octal,
pub fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Self: Pointer,
pub fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Self: UpperExp,
pub fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Self: UpperHex,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pipe for T where
T: ?Sized,
T: ?Sized,
pub fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
pub fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
R: 'a,
pub fn pipe_ref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
pub fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
B: 'a + ?Sized,
R: 'a,
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
Self: Borrow<B>,
pub fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
B: 'a + ?Sized,
R: 'a,
Self: BorrowMut<B>,
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
B: 'a + ?Sized,
R: 'a,
Self: BorrowMut<B>,
pub fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
R: 'a,
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Self: AsRef<U>,
U: 'a + ?Sized,
pub fn pipe_as_mut<'a, U, R>(
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
R: 'a,
Self: AsMut<U>,
U: 'a + ?Sized,
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
R: 'a,
Self: AsMut<U>,
U: 'a + ?Sized,
pub fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
R: 'a,
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Self: Deref<Target = T>,
T: 'a + ?Sized,
pub fn pipe_deref_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
R: 'a,
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
R: 'a,
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
impl<T> Pipe for T
impl<T> PipeAsRef for T
pub fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
R: 'a,
Self: AsRef<T>,
T: 'a,
R: 'a,
Self: AsRef<T>,
T: 'a,
pub fn pipe_as_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
R: 'a,
Self: AsMut<T>,
T: 'a,
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
R: 'a,
Self: AsMut<T>,
T: 'a,
impl<T> PipeBorrow for T
pub fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
R: 'a,
Self: Borrow<T>,
T: 'a,
R: 'a,
Self: Borrow<T>,
T: 'a,
pub fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
R: 'a,
Self: BorrowMut<T>,
T: 'a,
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
R: 'a,
Self: BorrowMut<T>,
T: 'a,
impl<T> PipeDeref for T
pub fn pipe_deref<'a, R>(
&'a self,
func: impl FnOnce(&'a Self::Target) -> R
) -> R where
R: 'a,
Self: Deref,
&'a self,
func: impl FnOnce(&'a Self::Target) -> R
) -> R where
R: 'a,
Self: Deref,
pub fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
R: 'a,
Self: DerefMut,
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
R: 'a,
Self: DerefMut,
impl<T> PipeRef for T
pub fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
R: 'a,
pub fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
R: 'a,
impl<T> Tap for T
pub fn tap(self, func: impl FnOnce(&Self)) -> Self
pub fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self
pub fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
B: ?Sized,
Self: Borrow<B>,
B: ?Sized,
Self: Borrow<B>,
pub fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
B: ?Sized,
Self: BorrowMut<B>,
B: ?Sized,
Self: BorrowMut<B>,
pub fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
R: ?Sized,
Self: AsRef<R>,
R: ?Sized,
Self: AsRef<R>,
pub fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
R: ?Sized,
Self: AsMut<R>,
R: ?Sized,
Self: AsMut<R>,
pub fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
pub fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
pub fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
pub fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
B: ?Sized,
Self: Borrow<B>,
B: ?Sized,
Self: Borrow<B>,
pub fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
B: ?Sized,
Self: BorrowMut<B>,
B: ?Sized,
Self: BorrowMut<B>,
pub fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
R: ?Sized,
Self: AsRef<R>,
R: ?Sized,
Self: AsRef<R>,
pub fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
R: ?Sized,
Self: AsMut<R>,
R: ?Sized,
Self: AsMut<R>,
pub fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
impl<T> Tap for T
pub fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
F: FnOnce(&Self) -> R,
pub fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
F: FnOnce(&Self) -> R,
pub fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
F: FnOnce(&mut Self) -> R,
pub fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
F: FnOnce(&mut Self) -> R,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
U: ?Sized,
pub fn tap_ref<F, R>(self, func: F) -> Self where
F: FnOnce(&T) -> R,
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Self: AsRef<T>,
pub fn tap_ref_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&T) -> R,
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Self: AsRef<T>,
pub fn tap_ref_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut T) -> R,
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Self: AsMut<T>,
pub fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut T) -> R,
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Self: AsMut<T>,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
U: ?Sized,
pub fn tap_borrow<F, R>(self, func: F) -> Self where
F: FnOnce(&T) -> R,
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Self: Borrow<T>,
pub fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&T) -> R,
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Self: Borrow<T>,
pub fn tap_borrow_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut T) -> R,
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Self: BorrowMut<T>,
pub fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut T) -> R,
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Self: BorrowMut<T>,
impl<T> TapDeref for T
pub fn tap_deref<F, R>(self, func: F) -> Self where
F: FnOnce(&Self::Target) -> R,
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Self: Deref,
pub fn tap_deref_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self::Target) -> R,
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Self: Deref,
pub fn tap_deref_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self::Target) -> R,
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Self: DerefMut,
pub fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self::Target) -> R,
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Self: DerefMut,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> TryConv for T
impl<T> TryConv for T
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,