mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 23:07:46 +02:00
Infer types from regular delimited plain text unstructured files. (#1494)
* Infer types from regular delimited plain text unstructured files. * Nothing resolves to an empty string.
This commit is contained in:
committed by
GitHub
parent
d8c4565413
commit
b36d21e76f
@ -659,6 +659,27 @@ impl Span {
|
||||
self.start == 0 && self.end == 0
|
||||
}
|
||||
|
||||
/// Returns a bool if the current Span does not cover.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// // make clean
|
||||
/// // ----
|
||||
/// // (0,4)
|
||||
/// //
|
||||
/// // ^(5,5)
|
||||
///
|
||||
/// let make_span = Span::new(0,4);
|
||||
/// let clean_span = Span::new(5,5);
|
||||
///
|
||||
/// assert_eq!(make_span.is_closed(), false);
|
||||
/// assert_eq!(clean_span.is_closed(), true);
|
||||
/// ```
|
||||
pub fn is_closed(&self) -> bool {
|
||||
self.start == self.end
|
||||
}
|
||||
|
||||
/// Returns a slice of the input that covers the start and end of the current Span.
|
||||
pub fn slice<'a>(&self, source: &'a str) -> &'a str {
|
||||
&source[self.start..self.end]
|
||||
|
Reference in New Issue
Block a user