Enum fraction::prelude::GenericFraction

source ·
pub enum GenericFraction<T>
where T: Clone + Integer,
{ Rational(Sign, Ratio<T>), Infinity(Sign), NaN, }
Expand description

Generic implementation of the fraction type

§Examples

use fraction::GenericFraction;

type F = GenericFraction<u8>;

let first = F::new (1u8, 2u8);
let second = F::new (2u8, 8u8);

assert_eq! (first + second, F::new (3u8, 4u8));

Since GenericFraction keeps its sign explicitly and independently of the numerics, it is not recommended to use signed types, although it’s completely valid with the cost of target type capacity.

use fraction::GenericFraction;

type F = GenericFraction<i8>;

let first = F::new (1, 2);
let second = F::new (2, 8);

assert_eq! (first + second, F::new (3, 4));

Variants§

§

Rational(Sign, Ratio<T>)

§

Infinity(Sign)

§

NaN

Implementations§

source§

impl<T: Clone + Integer + ToBigUint + ToBigInt + GenericInteger> GenericFraction<T>

Various square root operations for GenericFraction.

source

pub fn sqrt_abs_with_accuracy_raw( &self, accuracy: impl Borrow<Accuracy> ) -> RawApprox

Returns an unsimplified rational approximation of the principal square root of the absolute value of self. accuracy is the accuracy of the square of the return value relative to self.

See the module-level documentation for more details.

source

pub fn sqrt_abs_with_accuracy( &self, accuracy: impl Borrow<Accuracy> ) -> GenericFraction<BigUint>

Returns a rational approximation of the principal square root of the absolute value of self. accuracy is the accuracy of the square of the return value relative to self.

See the module-level documentation for more details.

source

pub fn sqrt_abs_raw(&self, decimal_places: u32) -> RawApprox

Returns an unsimplified rational approximation of the principal square root of the absolute value of self. decimal_places refers to the accuracy of the square of the return value relative to self.

See the module-level documentation for more details.

source

pub fn sqrt_abs(&self, decimal_places: u32) -> GenericFraction<BigUint>

Returns a rational approximation of the principal square root of the absolute value of self. decimal_places refers to the accuracy of the square of the return value relative to self.

See the module-level documentation for more details.

source

pub fn sqrt_with_accuracy_raw( &self, accuracy: impl Borrow<Accuracy> ) -> RawApprox

Returns an unsimplified rational approximation of the principal square root of self. accuracy refers to the square of the return value relative to self.

This method returns NaN if self is negative.

See the module-level documentation for more details.

source

pub fn sqrt_with_accuracy( &self, accuracy: impl Borrow<Accuracy> ) -> GenericFraction<BigUint>

Returns a rational approximation of the principal square root of self. accuracy refers to the square of the return value relative to self.

This method returns NaN if self is negative.

See the module-level documentation for more details.

source

pub fn sqrt_raw(&self, decimal_places: u32) -> RawApprox

Returns an unsimplified rational approximation of the principal square root of self. decimal_places refers to the accuracy of the square of the return value relative to self.

This method returns NaN if self is negative.

See the module-level documentation for more details.

source

pub fn sqrt(&self, decimal_places: u32) -> GenericFraction<BigUint>

Returns a rational approximation of the principal square root of self. decimal_places refers to the accuracy of the square of the return value relative to self.

This method returns NaN if self is negative.

See the module-level documentation for more details.

source§

impl<T: Clone + Integer + Display> GenericFraction<T>

source

pub fn get_unicode_display(&self) -> UnicodeDisplay<'_, T>

Display the fraction using FRACTION SLASH ‘\u{2044}’ ‘⁄’ If you have font support, this is the way Unicode wants to display fractions

use fraction::Fraction;
assert_eq!(
  format!("{}", Fraction::new(1u8,2u8).get_unicode_display()),
  "1⁄2"
);
assert_eq!(
  format!("{}", Fraction::new(3u8,2u8).get_unicode_display()),
  "3⁄2"
);
source§

impl<T: Clone + Integer + From<u8>> GenericFraction<T>

source

pub fn from_unicode_str(input: &str) -> Result<Self, ParseError>

Parse a unicode string The string can be:

  • A normal fraction e.g. “1/2”
  • A vulgar fraction e.g. ‘½’
  • A mixed vulgar fraction “1½”
  • A unicode fraction e.g. “1⁄2” where ‘⁄’ can be any of:
    • ‘/’ ASCII SOLIDUS
    • ‘⁄’ FRACTION SLASH
    • ‘∕’ DIVISION SLASH
    • ‘÷’ DIVISION SIGN
  • A mixed unicode fraction: “1\u{2063}1⁄2”: 1⁤1⁄2
    • ‘\u{2064}’ INVISIBLE PLUS
    • ‘\u{2063}’ INVISIBLE SEPARATOR
    • NOT ‘\u{2062}’ INVISIBLE TIMES
  • A super-subscript fraction “¹/₂”
  • A mixed super-subscript fraction “1¹/₂”

Focus is on being lenient towards input rather than being fast.

use fraction::Fraction;
let v = vec![
 ("1/2", Fraction::new(1u8,2u8)),
 ("-1/2", Fraction::new_neg(1u8,2u8)),
 ("½", Fraction::new(1u8,2u8)),
 // ("1½", Fraction::new(3u8,2u8)),       // mixed vulgar fractions
 // ("-1½", Fraction::new_neg(3u8,2u8)),  // currently not supported
 ("1⁄2", Fraction::new(1u8,2u8)),
 ("-1⁄2", Fraction::new_neg(1u8,2u8)),
 ("1⁤1⁄2", Fraction::new(3u8,2u8)),
 ("-1⁤1⁄2", Fraction::new_neg(3u8,2u8)),
 ("¹/₂", Fraction::new(1u8,2u8)),
 ("-¹/₂", Fraction::new_neg(1u8,2u8)),
 ("1¹/₂", Fraction::new(3u8,2u8)),
 ("-1¹/₂", Fraction::new_neg(3u8,2u8)),
];
for (f_str, f) in v {
  assert_eq!(Fraction::from_unicode_str(f_str), Ok(f))
}
source§

impl<T> GenericFraction<T>
where T: Clone + Integer,

source

pub fn new_generic<N, D>( sign: Sign, num: N, den: D ) -> Option<GenericFraction<T>>

Constructs a new fraction with the specified numerator and denominator Handles gracefully signed integers even if the storage type is unsigned and vise versa The arguments can be of any integer types imlementing the necessary traits

§Examples
use fraction::{GenericFraction, Sign};
type F = GenericFraction<u16>;

let f12 = F::new_generic(Sign::Plus, 1i8, 2u8).unwrap();
let f34 = F::new_generic(Sign::Plus, 3i16, 4u32).unwrap();
let f56 = F::new_generic(Sign::Plus, 5i64, 6u128).unwrap();
let f78 = F::new_generic(Sign::Plus, 7usize, 8isize).unwrap();

assert_eq! ((*f12.numer().unwrap(), *f12.denom().unwrap()), (1u16, 2u16));
assert_eq! ((*f34.numer().unwrap(), *f34.denom().unwrap()), (3u16, 4u16));
assert_eq! ((*f56.numer().unwrap(), *f56.denom().unwrap()), (5u16, 6u16));
assert_eq! ((*f78.numer().unwrap(), *f78.denom().unwrap()), (7u16, 8u16));
source

pub fn new<N, D>(num: N, den: D) -> GenericFraction<T>
where N: Into<T>, D: Into<T>,

Constructs a new fraction with the specified numerator and denominator

The arguments must me either of T type, or implement Into<T> trait.

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u16>;

let _f = F::new(1u8, 2u16);
source

pub fn new_neg<N, D>(num: N, den: D) -> GenericFraction<T>
where N: Into<T>, D: Into<T>,

Constructs a new negative fraction with the specified numerator and denominator

The arguments must be either of T type, or implement Into<T> trait.

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u16>;

let _f = F::new_neg (1u8, 2u16);
source

pub const fn new_raw(num: T, den: T) -> GenericFraction<T>

Constructs a new fraction without types casting, checking for denom == 0 and reducing numbers.

You must be careful with this function because all the other functionality parts rely on the numbers to be reduced. That said, in the normal case 2/4 has to be reduced to 1/2, but it will not happen with new_raw.

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

let _f = F::new_raw (1u8, 2u8);
source

pub const fn new_raw_signed(sign: Sign, num: T, den: T) -> GenericFraction<T>

The same as fn new_raw, but allows explicitly set sign.

§Examples
use fraction::{GenericFraction, Sign};
type F = GenericFraction<u8>;

let _f = F::new_raw_signed(Sign::Minus, 1u8, 2u8);
source

pub const fn numer(&self) -> Option<&T>

Returns a reference to the numerator value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

let fra = F::new (5u8, 6u8);
assert_eq! (5, *fra.numer ().unwrap ());
source

pub const fn denom(&self) -> Option<&T>

Returns a reference to the denominator value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

let fra = F::new (5u8, 6u8);
assert_eq! (6, *fra.denom ().unwrap ());
source

pub const fn sign(&self) -> Option<Sign>

Returns a reference to the sign value

§Examples
use fraction::{ GenericFraction, Sign };
type F = GenericFraction<u8>;


let fra = F::new (5u8, 6u8);
assert_eq! (Sign::Plus, fra.sign ().unwrap ());

let fra = F::new_neg (5u8, 6u8);
assert_eq! (Sign::Minus, fra.sign ().unwrap ());


let fra = F::infinity ();
assert_eq! (Sign::Plus, fra.sign ().unwrap ());

let fra = F::neg_infinity ();
assert_eq! (Sign::Minus, fra.sign ().unwrap ());


let fra = F::nan ();
assert_eq! (None, fra.sign ());
source

pub fn from_fraction<F>(from: GenericFraction<F>) -> GenericFraction<T>
where T: From<F>, F: Clone + Integer,

Generates a GenericFraction from GenericFraction where T: From

use fraction::{ Fraction, GenericFraction };
type F8 = GenericFraction<u8>;

let fra8 = F8::new (5u8, 6u8);
assert_eq! (Fraction::new (5u64, 6u64), Fraction::from_fraction(fra8));
source

pub fn into_fraction<I>(self) -> GenericFraction<I>
where T: Into<I>, I: Clone + Integer,

Generates a GenericFraction from GenericFraction where T: Into

use fraction::{ Fraction, GenericFraction };
type F8 = GenericFraction<u8>;

let fra8 = F8::new (5u8, 6u8);
assert_eq! (Fraction::new (5u64, 6u64), fra8.into_fraction());
source§

impl<T: Clone + Integer> GenericFraction<T>

source

pub const fn nan() -> Self

Returns NaN value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::nan (), F::new (0, 0));
source

pub const fn infinity() -> Self

Returns positive Infinity value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::infinity (), F::new (1, 0));
source

pub const fn neg_infinity() -> Self

Returns negative Infinity value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::neg_infinity (), F::new_neg (1, 0));
source

pub fn neg_zero() -> Self

Returns zero with negative sign

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::neg_zero (), F::new_neg (0, 1));
source

pub fn min_positive_value() -> Self
where T: Bounded,

Returns minimal value greater than zero

§Examples
use fraction::GenericFraction;
type F8 = GenericFraction<u8>;
type F16 = GenericFraction<u16>;

assert_eq! (F8::min_positive_value (), F8::new (1u8, 255u8));
assert_eq! (F16::min_positive_value (), F16::new (1u16, 65535u16));
source

pub const fn is_nan(&self) -> bool

Returns true if the value is NaN

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert! (F::nan ().is_nan ());
assert! (F::new (0, 0).is_nan ());
source

pub const fn is_infinite(&self) -> bool

Returns true if the value is Infinity (does not matter positive or negative)

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert! (F::infinity ().is_infinite ());
assert! (F::new (1u8, 0).is_infinite ());
assert! (F::new_neg (1u8, 0).is_infinite ());
source

pub const fn is_finite(&self) -> bool

Returns true if the value is not Infinity (does not matter positive or negative)

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert! (! F::infinity ().is_finite ());
assert! (! F::new (1u8, 0).is_finite ());
assert! (! F::new_neg (1u8, 0).is_finite ());
source

pub fn is_normal(&self) -> bool

Returns true if the number is neither zero, Infinity or NaN

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert! (! F::nan ().is_normal ());
assert! (! F::infinity ().is_normal ());
assert! (! F::neg_infinity ().is_normal ());
assert! (! F::new (0, 1u8).is_normal ());
assert! (! F::neg_zero ().is_normal ());
source

pub fn classify(&self) -> FpCategory

Returns the floating point category of the number

§Examples
use std::num::FpCategory;
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::nan ().classify (), FpCategory::Nan);
assert_eq! (F::infinity ().classify (), FpCategory::Infinite);
assert_eq! (F::new (0, 1u8).classify (), FpCategory::Zero);
assert_eq! (F::new (1u8, 1u8).classify (), FpCategory::Normal);
source

pub fn floor(&self) -> Self

Returns the largest integer less than or equal to the value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (7u8, 5u8).floor (), F::new (5u8, 5u8));
assert_eq! (F::new_neg (4u8, 3u8).floor (), F::new_neg (2u8, 1u8));
source

pub fn ceil(&self) -> Self

Returns the smallest integer greater than or equal to the value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (7u8, 5u8).ceil (), F::new (10u8, 5u8));
assert_eq! (F::new_neg (4u8, 3u8).ceil (), F::new_neg (1u8, 1u8));
source

pub fn round(&self) -> Self

Returns the nearest integer to the value (.5 goes away from zero)

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (7u8, 5u8).round (), F::new (5u8, 5u8));
assert_eq! (F::new (8u8, 5u8).round (), F::new (10u8, 5u8));
assert_eq! (F::new (3u8, 2u8).round (), F::new (4u8, 2u8));
assert_eq! (F::new (1u8, 2u8).round (), F::new (2u8, 2u8));
assert_eq! (F::new_neg (3u8, 2u8).round (), F::new_neg (2u8, 1u8));
source

pub fn trunc(&self) -> Self

Returns the integer part of the value

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (7u8, 5u8).trunc (), F::new (5u8, 5u8));
assert_eq! (F::new (8u8, 5u8).trunc (), F::new (5u8, 5u8));
source

pub fn fract(&self) -> Self

Returns the fractional part of a number

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (7u8, 5u8).fract (), F::new (2u8, 5u8));
assert_eq! (F::new (8u8, 5u8).fract (), F::new (3u8, 5u8));
source

pub fn abs(&self) -> Self

Returns the absolute value of self

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::nan ().abs (), F::nan ());
assert_eq! (F::infinity ().abs (), F::infinity ());
assert_eq! (F::neg_infinity ().abs (), F::infinity ());
assert_eq! (F::new (1u8, 2u8).abs (), F::new (1u8, 2u8));
assert_eq! (F::new_neg (1u8, 2u8).abs (), F::new (1u8, 2u8));
source

pub fn signum(&self) -> Self

Returns a number that represents the sign of self

  • 1.0 if the number is positive, +0.0 or INFINITY
  • -1.0 if the number is negative, -0.0 or NEG_INFINITY
  • NAN if the number is NAN
§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (1u8, 2u8).signum (), F::new (1u8, 1u8));
assert_eq! (F::new (0u8, 1u8).signum (), F::new (1u8, 1u8));
assert_eq! (F::infinity ().signum (), F::new (1u8, 1u8));
assert_eq! (F::new_neg (1u8, 2u8).signum (), F::new_neg (1u8, 1u8));
assert_eq! (F::neg_zero ().signum (), F::new_neg (1u8, 1u8));
assert_eq! (F::neg_infinity ().signum (), F::new_neg (1u8, 1u8));
assert_eq! (F::nan ().signum (), F::nan ());
source

pub const fn is_sign_positive(&self) -> bool

Returns true if the sign is positive

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert! (F::new (1u8, 2u8).is_sign_positive ());
assert! (F::infinity ().is_sign_positive ());
assert! (! F::nan ().is_sign_positive ());
source

pub const fn is_sign_negative(&self) -> bool

Returns true if the sign is negative

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert! (F::new_neg (1u8, 2u8).is_sign_negative ());
assert! (F::neg_zero ().is_sign_negative ());
assert! (F::neg_infinity ().is_sign_negative ());
assert! (! F::nan ().is_sign_negative ());
source

pub fn mul_add(&self, a: Self, b: Self) -> Self

self.clone () * a + b

Added for interface compatibility with float types

source

pub fn recip(&self) -> Self

Takes the reciprocal (inverse) of the value (1/x)

§Examples
use fraction::GenericFraction;
type F = GenericFraction<u8>;

assert_eq! (F::new (1u8, 2u8).recip (), F::new (2u8, 1u8));
assert_eq! (F::new (0u8, 1u8).recip (), F::infinity ());
assert_eq! (F::infinity ().recip (), F::new (0u8, 1u8));
assert_eq! (F::nan ().recip (), F::nan ());

Trait Implementations§

source§

impl<'a, T, O> Add<O> for &'a GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the + operator.
source§

fn add(self, other: O) -> GenericFraction<T>

Performs the + operation. Read more
source§

impl<T, O> Add<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the + operator.
source§

fn add(self, other: O) -> Self

Performs the + operation. Read more
source§

impl<'a, T> Add for &'a GenericFraction<T>
where T: Clone + Integer,

§

type Output = GenericFraction<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> GenericFraction<T>

Performs the + operation. Read more
source§

impl<'a, T> AddAssign<&'a GenericFraction<T>> for GenericFraction<T>
where T: Clone + Integer,

source§

fn add_assign(&mut self, other: &'a Self)

Performs the += operation. Read more
source§

impl<T, O> AddAssign<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

source§

fn add_assign(&mut self, other: O)

Performs the += operation. Read more
source§

impl<T: Bounded + Clone + Integer> Bounded for GenericFraction<T>

source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
source§

fn max_value() -> Self

Returns the largest finite number this type can represent
source§

impl<T> CheckedAdd for GenericFraction<T>

source§

fn checked_add(&self, other: &Self) -> Option<GenericFraction<T>>

Adds two numbers, checking for overflow. If overflow happens, None is returned.
source§

impl<T> CheckedDiv for GenericFraction<T>

source§

fn checked_div(&self, other: &Self) -> Option<GenericFraction<T>>

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.
source§

impl<T> CheckedMul for GenericFraction<T>
where T: Clone + Integer + CheckedMul,

source§

fn checked_mul(&self, other: &Self) -> Option<GenericFraction<T>>

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.
source§

impl<T> CheckedSub for GenericFraction<T>

source§

fn checked_sub(&self, other: &Self) -> Option<GenericFraction<T>>

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.
source§

impl<T> Clone for GenericFraction<T>
where T: Clone + Integer + Clone,

source§

fn clone(&self) -> GenericFraction<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ConstOne + Integer + Clone> ConstOne for GenericFraction<T>

source§

const ONE: GenericFraction<T> = _

The multiplicative identity element of Self, 1.
source§

impl<T: ConstOne + ConstZero + Integer + Clone> ConstZero for GenericFraction<T>

source§

const ZERO: GenericFraction<T> = _

The additive identity element of Self, 0.
source§

impl<T> Debug for GenericFraction<T>
where T: Clone + Integer + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Default for GenericFraction<T>
where T: Clone + Integer,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de, T> Deserialize<'de> for GenericFraction<T>
where T: Clone + Integer + Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Clone + GenericInteger> Display for GenericFraction<T>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, T, O> Div<O> for &'a GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the / operator.
source§

fn div(self, other: O) -> GenericFraction<T>

Performs the / operation. Read more
source§

impl<T, O> Div<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the / operator.
source§

fn div(self, other: O) -> Self

Performs the / operation. Read more
source§

impl<'a, T> Div for &'a GenericFraction<T>
where T: Clone + Integer,

§

type Output = GenericFraction<T>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> GenericFraction<T>

Performs the / operation. Read more
source§

impl<'a, T> DivAssign<&'a GenericFraction<T>> for GenericFraction<T>
where T: Clone + Integer,

source§

fn div_assign(&mut self, other: &'a Self)

Performs the /= operation. Read more
source§

impl<T, O> DivAssign<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

source§

fn div_assign(&mut self, other: O)

Performs the /= operation. Read more
source§

impl<T, N, D> From<(N, D)> for GenericFraction<T>

source§

fn from(pair: (N, D)) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<BigInt> for GenericFraction<T>

source§

fn from(val: BigInt) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<BigUint> for GenericFraction<T>

source§

fn from(val: BigUint) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl From<RawApprox> for GenericFraction<BigUint>

source§

fn from(v: RawApprox) -> Self

Converts to this type from the input type.
source§

impl<T: Clone + FromPrimitive + Integer + CheckedAdd + CheckedMul + CheckedSub> From<f32> for GenericFraction<T>

source§

fn from(val: f32) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T: Clone + FromPrimitive + Integer + CheckedAdd + CheckedMul + CheckedSub> From<f64> for GenericFraction<T>

source§

fn from(val: f64) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<i128> for GenericFraction<T>

source§

fn from(val: i128) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<i16> for GenericFraction<T>

source§

fn from(val: i16) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<i32> for GenericFraction<T>

source§

fn from(val: i32) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<i64> for GenericFraction<T>

source§

fn from(val: i64) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<i8> for GenericFraction<T>

source§

fn from(val: i8) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<isize> for GenericFraction<T>

source§

fn from(val: isize) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<u128> for GenericFraction<T>

source§

fn from(val: u128) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<u16> for GenericFraction<T>

source§

fn from(val: u16) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<u32> for GenericFraction<T>

source§

fn from(val: u32) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<u64> for GenericFraction<T>

source§

fn from(val: u64) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<u8> for GenericFraction<T>

source§

fn from(val: u8) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<T> From<usize> for GenericFraction<T>

source§

fn from(val: usize) -> GenericFraction<T>

Converts to this type from the input type.
source§

impl<S, T> FromInputValue<S> for GenericFraction<T>

source§

fn from_input_value(value: &InputValue<S>) -> Option<Self>

Performs the conversion.
source§

fn from_implicit_null() -> Self

Performs the conversion from an absent value (e.g. to distinguish between implicit and explicit null). The default implementation just uses from_input_value as if an explicit null were provided. This conversion must not fail.
source§

impl<'a, T> FromSql<'a> for GenericFraction<T>
where T: Clone + GenericInteger + From<u16>,

source§

fn from_sql( _ty: &Type, raw: &'a [u8] ) -> Result<Self, Box<dyn Error + Sync + Send>>

Creates a new value of this type from a buffer of data of the specified Postgres Type in its binary format. Read more
source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be created from the specified Postgres Type.
source§

fn from_sql_null(ty: &Type) -> Result<Self, Box<dyn Error + Send + Sync>>

Creates a new value of this type from a NULL SQL value. Read more
source§

fn from_sql_nullable( ty: &Type, raw: Option<&'a [u8]> ) -> Result<Self, Box<dyn Error + Send + Sync>>

A convenience function that delegates to from_sql and from_sql_null depending on the value of raw.
source§

impl<T> FromStr for GenericFraction<T>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(src: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<S, T> GraphQLType<S> for GenericFraction<T>

source§

fn name(_: &Self::TypeInfo) -> Option<&'static str>

Returns name of this GraphQLType to expose. Read more
source§

fn meta<'r>( info: &Self::TypeInfo, registry: &mut Registry<'r, S> ) -> MetaType<'r, S>
where S: 'r,

Returns MetaType representing this GraphQLType.
source§

impl<S, T> GraphQLValue<S> for GenericFraction<T>

§

type Context = ()

Context type for this GraphQLValue. Read more
§

type TypeInfo = ()

Type that may carry additional schema information for this GraphQLValue. Read more
source§

fn type_name<'__i>(&self, info: &'__i Self::TypeInfo) -> Option<&'__i str>

Returns name of the GraphQLType exposed by this GraphQLValue. Read more
source§

fn resolve( &self, _info: &(), _selection: Option<&[Selection<'_, S>]>, _executor: &Executor<'_, '_, Self::Context, S> ) -> ExecutionResult<S>

Resolves the provided selection_set against this GraphQLValue. Read more
source§

fn resolve_field( &self, _info: &Self::TypeInfo, _field_name: &str, _arguments: &Arguments<'_, S>, _executor: &Executor<'_, '_, Self::Context, S> ) -> Result<Value<S>, FieldError<S>>

Resolves the value of a single field on this GraphQLValue. Read more
source§

fn resolve_into_type( &self, info: &Self::TypeInfo, type_name: &str, selection_set: Option<&[Selection<'_, S>]>, executor: &Executor<'_, '_, Self::Context, S> ) -> Result<Value<S>, FieldError<S>>

Resolves this GraphQLValue (being an interface or an union) into a concrete downstream object type. Read more
source§

fn concrete_type_name( &self, context: &Self::Context, info: &Self::TypeInfo ) -> String

Returns the concrete GraphQLType name for this GraphQLValue being an interface, an union or an object. Read more
source§

impl<__S, T> GraphQLValueAsync<__S> for GenericFraction<T>
where Self: Sync, Self::TypeInfo: Sync, Self::Context: Sync, T: Clone + GenericInteger, __S: ScalarValue + Send + Sync,

source§

fn resolve_async<'a>( &'a self, info: &'a Self::TypeInfo, selection_set: Option<&'a [Selection<'_, __S>]>, executor: &'a Executor<'_, '_, Self::Context, __S> ) -> BoxFuture<'a, ExecutionResult<__S>>

Resolves the provided selection_set against this GraphQLValueAsync. Read more
source§

fn resolve_field_async<'a>( &'a self, _info: &'a Self::TypeInfo, _field_name: &'a str, _arguments: &'a Arguments<'_, S>, _executor: &'a Executor<'_, '_, Self::Context, S> ) -> Pin<Box<dyn Future<Output = Result<Value<S>, FieldError<S>>> + Send + 'a>>

Resolves the value of a single field on this GraphQLValueAsync. Read more
source§

fn resolve_into_type_async<'a>( &'a self, info: &'a Self::TypeInfo, type_name: &str, selection_set: Option<&'a [Selection<'a, S>]>, executor: &'a Executor<'a, 'a, Self::Context, S> ) -> Pin<Box<dyn Future<Output = Result<Value<S>, FieldError<S>>> + Send + 'a>>

Resolves this GraphQLValueAsync (being an interface or an union) into a concrete downstream object type. Read more
source§

impl<T: Clone + Integer + Hash> Hash for GenericFraction<T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<S, T> IsInputType<S> for GenericFraction<T>

source§

fn mark()

An arbitrary function without meaning. Read more
source§

impl<S, T> IsOutputType<S> for GenericFraction<T>

source§

fn mark()

An arbitrary function without meaning. Read more
source§

impl<'a, T, O> Mul<O> for &'a GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: O) -> GenericFraction<T>

Performs the * operation. Read more
source§

impl<T, O> Mul<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: O) -> Self

Performs the * operation. Read more
source§

impl<'a, T> Mul for &'a GenericFraction<T>
where T: Clone + Integer,

§

type Output = GenericFraction<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> GenericFraction<T>

Performs the * operation. Read more
source§

impl<'a, T> MulAssign<&'a GenericFraction<T>> for GenericFraction<T>
where T: Clone + Integer,

source§

fn mul_assign(&mut self, other: &'a Self)

Performs the *= operation. Read more
source§

impl<T, O> MulAssign<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

source§

fn mul_assign(&mut self, other: O)

Performs the *= operation. Read more
source§

impl<'a, T: Clone + Integer> Neg for &'a GenericFraction<T>

§

type Output = GenericFraction<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T: Clone + Integer> Neg for GenericFraction<T>

§

type Output = GenericFraction<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<T: Clone + Integer> Num for GenericFraction<T>

§

type FromStrRadixErr = ParseRatioError

source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
source§

impl<T: Clone + Integer> One for GenericFraction<T>

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl<T: Clone + Integer> Ord for GenericFraction<T>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<S, T> ParseScalarValue<S> for GenericFraction<T>

source§

fn from_str(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>

See the trait documentation
source§

impl<T: Clone + Integer> PartialEq for GenericFraction<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Clone + Integer> PartialOrd for GenericFraction<T>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, T: 'a + Clone + Integer> Product<&'a GenericFraction<T>> for GenericFraction<T>

source§

fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<T: Clone + Integer> Product for GenericFraction<T>

source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<'a, T, O> Rem<O> for &'a GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: O) -> GenericFraction<T>

Performs the % operation. Read more
source§

impl<T, O> Rem<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: O) -> Self

Performs the % operation. Read more
source§

impl<'a, T> Rem for &'a GenericFraction<T>
where T: Clone + Integer,

§

type Output = GenericFraction<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> GenericFraction<T>

Performs the % operation. Read more
source§

impl<'a, T> RemAssign<&'a GenericFraction<T>> for GenericFraction<T>
where T: Clone + Integer,

source§

fn rem_assign(&mut self, other: &'a Self)

Performs the %= operation. Read more
source§

impl<T, O> RemAssign<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

source§

fn rem_assign(&mut self, other: O)

Performs the %= operation. Read more
source§

impl<T> Serialize for GenericFraction<T>
where T: Clone + Integer + Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Clone + Integer> Signed for GenericFraction<T>

source§

fn abs(&self) -> Self

Computes the absolute value. Read more
source§

fn abs_sub(&self, other: &Self) -> Self

The positive difference of two numbers. Read more
source§

fn signum(&self) -> Self

Returns the sign of the number. Read more
source§

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.
source§

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.
source§

impl<'a, T, O> Sub<O> for &'a GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: O) -> GenericFraction<T>

Performs the - operation. Read more
source§

impl<T, O> Sub<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

§

type Output = GenericFraction<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: O) -> Self

Performs the - operation. Read more
source§

impl<'a, T> Sub for &'a GenericFraction<T>
where T: Clone + Integer,

§

type Output = GenericFraction<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> GenericFraction<T>

Performs the - operation. Read more
source§

impl<'a, T> SubAssign<&'a GenericFraction<T>> for GenericFraction<T>
where T: Clone + Integer,

source§

fn sub_assign(&mut self, other: &'a Self)

Performs the -= operation. Read more
source§

impl<T, O> SubAssign<O> for GenericFraction<T>
where T: Clone + Integer, O: Into<GenericFraction<T>>,

source§

fn sub_assign(&mut self, other: O)

Performs the -= operation. Read more
source§

impl<'a, T: 'a + Clone + Integer> Sum<&'a GenericFraction<T>> for GenericFraction<T>

source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<T: Clone + Integer> Sum for GenericFraction<T>

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<S, T> ToInputValue<S> for GenericFraction<T>

source§

fn to_input_value(&self) -> InputValue<S>

Performs the conversion.
source§

impl<T: Clone + Integer + PartialEq + ToPrimitive> ToPrimitive for GenericFraction<T>

source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
source§

impl<T> ToSql for GenericFraction<T>
where T: Clone + GenericInteger + From<u8> + Debug,

source§

fn to_sql( &self, ty: &Type, buf: &mut BytesMut ) -> Result<IsNull, Box<dyn Error + Sync + Send>>

Converts the value of self into the binary format of the specified Postgres Type, appending it to out. Read more
source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be converted to the specified Postgres Type.
source§

fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut ) -> Result<IsNull, Box<dyn Error + Sync + Send>>

An adaptor method used internally by Rust-Postgres. Read more
source§

fn encode_format(&self, _ty: &Type) -> Format

Specify the encode format
source§

impl<T> TryFrom<GenericFraction<T>> for BigInt
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for BigUint
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for f32
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for f64
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for i128
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for i16
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for i32
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for i64
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for i8
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for isize
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for u128
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for u16
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for u32
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for u64
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for u8
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> TryFrom<GenericFraction<T>> for usize
where T: Clone + GenericInteger,

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: GenericFraction<T>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T, F> TryToConvertFrom<GenericFraction<F>> for GenericFraction<T>
where T: TryToConvertFrom<F> + Clone + Integer, F: Clone + Integer,

source§

impl<T: Clone + Integer> Zero for GenericFraction<T>

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<T> Copy for GenericFraction<T>
where T: Copy + Integer,

Copy semantics to be applied for the target type, but only if T also has it.

source§

impl<T: Clone + Integer> Eq for GenericFraction<T>

Auto Trait Implementations§

§

impl<T> Freeze for GenericFraction<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for GenericFraction<T>
where T: RefUnwindSafe,

§

impl<T> Send for GenericFraction<T>
where T: Send,

§

impl<T> Sync for GenericFraction<T>
where T: Sync,

§

impl<T> Unpin for GenericFraction<T>
where T: Unpin,

§

impl<T> UnwindSafe for GenericFraction<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> BorrowToSql for T
where T: ToSql,

source§

fn borrow_to_sql(&self) -> &dyn ToSql

Returns a reference to self as a ToSql trait object.
source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> LowerBounded for T
where T: Bounded,

source§

fn min_value() -> T

Returns the smallest finite number this type can represent
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UpperBounded for T
where T: Bounded,

source§

fn max_value() -> T

Returns the largest finite number this type can represent
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> FromSqlOwned for T
where T: for<'a> FromSql<'a>,

source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,