[−][src]Struct vimwiki::elements::Region
Represents a region in a string or file, comprised of a start and end
Implementations
impl Region[src]
pub fn new(offset: usize, len: usize) -> Self[src]
Constructs a new region with the given offset and length, containing no extra information
pub fn new_with_position(offset: usize, len: usize, position: Position) -> Self[src]
Constructs a new region with the given offset, length, and extra information about the line & column position
pub fn with_position(self, position: Position) -> Self[src]
Consumes the given region and returns a new one with its position set to the provided position
pub fn from_span_with_position(span: Span<'_>) -> Self[src]
Constructs a new region based on the offset and length of the given span. Additionally, computes the line & column position of the region.
pub fn contains(&self, offset: usize) -> bool[src]
Checks if a position is contained within this region
pub fn offset(&self) -> usize[src]
The offset of the region relative to some span of input
pub fn len(&self) -> usize[src]
The length of the region
pub fn is_empty(&self) -> bool[src]
Returns true if the length of the region is zero
pub fn position(&self) -> Option<Position>[src]
Returns the position of the region relative to some span of input
Can be none if the region was not constructed with a position
Trait Implementations
impl Clone for Region[src]
impl Copy for Region[src]
impl Debug for Region[src]
impl Default for Region[src]
impl<'de> Deserialize<'de> for Region[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl Eq for Region[src]
impl From<(usize, usize)> for Region[src]
impl From<Range<usize>> for Region[src]
fn from(range: Range<usize>) -> Self[src]
Converts from start..end to Region { offset: start, len: end - start }
where end < start will result in a length of zero
impl From<RangeInclusive<usize>> for Region[src]
fn from(range: RangeInclusive<usize>) -> Self[src]
Converts from start..=end to Region { offset: start, len: end - start + 1 }
where end + 1 < start will result in a length of zero
impl From<RangeTo<usize>> for Region[src]
impl From<RangeToInclusive<usize>> for Region[src]
fn from(range: RangeToInclusive<usize>) -> Self[src]
Converts from ..=end to Region { offset: 0, len: end + 1 }
impl Hash for Region[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<Region> for Region[src]
impl Serialize for Region[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralEq for Region[src]
impl StructuralPartialEq for Region[src]
Auto Trait Implementations
impl RefUnwindSafe for Region
impl Send for Region
impl Sync for Region
impl Unpin for Region
impl UnwindSafe for Region
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
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, 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>,