Lines Matching refs:try_new
80 /// Values can also be validated at runtime with [`Bounded::try_new`].
86 /// assert!(Bounded::<u8, 4>::try_new(15).is_some());
89 /// assert!(Bounded::<u8, 4>::try_new(16).is_none());
306 /// let v = Bounded::<u8, 1>::try_new(1);
309 /// let v = Bounded::<i8, 4>::try_new(-2);
313 /// let v = Bounded::<u32, 8>::try_new(0x1ff);
318 /// let v = Bounded::<i8, 4>::try_new(-8);
320 /// let v = Bounded::<i8, 4>::try_new(-9);
322 /// let v = Bounded::<i8, 4>::try_new(7);
324 /// let v = Bounded::<i8, 4>::try_new(8);
327 pub fn try_new(value: T) -> Option<Self> {
338 /// use the fallible [`Self::try_new`] instead.
437 Bounded::<T, M>::try_new(self.get())
564 self.try_into().ok().and_then(Bounded::try_new)