Enum Bound
pub enum Bound<T>
An endpoint of a range of keys.
Examples
Bounds are range endpoints:
use *;
use RangeBounds;
assert_eq!;
assert_eq!;
assert_eq!;
Using a tuple of Bounds as an argument to BTreeMap::range.
Note that in most cases, it's better to use range syntax (1..5) instead.
use BTreeMap;
use ;
let mut map = new;
map.insert;
map.insert;
map.insert;
for in map.range
assert_eq!;
Variants
-
Included(T) An inclusive bound.
-
Excluded(T) An exclusive bound.
-
Unbounded An infinite endpoint. Indicates that there is no bound in this direction.
Implementations
impl<T> Bound<T>
const fn as_ref(&self) -> Bound<&T>Converts from
&Bound<T>toBound<&T>.const fn as_mut(&mut self) -> Bound<&mut T>Converts from
&mut Bound<T>toBound<&mut T>.fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Bound<U>Maps a
Bound<T>to aBound<U>by applying a function to the contained value (including bothIncludedandExcluded), returning aBoundof the same kind.Examples
use *; let bound_string = Included; assert_eq!;use Bound; use *; let unbounded_string: = Unbounded; assert_eq!;
impl<T: Clone> Bound<&T>
const fn cloned(self) -> Bound<T> where T: ~const Clone,Map a
Bound<&T>to aBound<T>by cloning the contents of the bound.Examples
use *; use RangeBounds; let a1 = Stringfrom; let = ; assert_eq!; assert_eq!;
impl<T: Copy> Bound<&T>
const fn copied(self) -> Bound<T>Map a
Bound<&T>to aBound<T>by copying the contents of the bound.Examples
use *; use RangeBounds; assert_eq!; assert_eq!;
Trait Implementations
impl<T: Copy> Copy for Bound<T>
impl<T: Debug> Debug for Bound<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: Hash> Hash for Bound<T>
fn hash<__H: Hasher>(&self, state: &mut __H)
impl<T: PartialEq> StructuralPartialEq for Bound<T>
impl<T: ~const Clone> Clone for Bound<T>
fn clone(&self) -> Self
impl<T: ~const Eq> Eq for Bound<T>
fn assert_fields_are_eq(&self)
impl<T: ~const PartialEq> PartialEq for Bound<T>
fn eq(&self, other: &Self) -> bool
Auto Trait Implementations
impl<T> Freeze for Bound<T>
where
T: Freeze + Freeze,
impl<T> RefUnwindSafe for Bound<T>
where
T: RefUnwindSafe + RefUnwindSafe,
impl<T> Send for Bound<T>
where
T: Send + Send,
impl<T> Sync for Bound<T>
where
T: Sync + Sync,
impl<T> Unpin for Bound<T>
where
T: Unpin + Unpin,
impl<T> UnsafeUnpin for Bound<T>
where
T: UnsafeUnpin + UnsafeUnpin,
impl<T> UnwindSafe for Bound<T>
where
T: UnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for Bound<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Bound<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Bound<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Bound<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Bound<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Printable for Bound<T>
where
T: Copy + Debug,
impl<T> SizeHint for Bound<T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Bound<T>
impl<T, U> Into<U> for Bound<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Bound<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Bound<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>