pub trait IntegerExt {
// Required methods
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx>;
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: IntTy) -> Integer;
fn from_uint_ty<C: HasDataLayout>(cx: &C, ity: UintTy) -> Integer;
fn discr_range_of_repr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128,
) -> (Integer, bool);
}Required Methods§
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx>
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: IntTy) -> Integer
fn from_uint_ty<C: HasDataLayout>(cx: &C, ity: UintTy) -> Integer
Sourcefn discr_range_of_repr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128,
) -> (Integer, bool)
fn discr_range_of_repr<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, max: i128, ) -> (Integer, bool)
Finds the appropriate Integer type and signedness for the given
signed discriminant range and #[repr] attribute.
N.B.: u128 values above i128::MAX will be treated as signed, but
that shouldn’t affect anything, other than maybe debuginfo.
This is the basis for computing the type of the tag of an enum (which can be smaller than
the type of the discriminant, which is determined by ReprOptions::discr_type).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl IntegerExt for Integer
impl IntegerExt for Integer
Source§fn discr_range_of_repr<'tcx>(
tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>,
repr: &ReprOptions,
min: i128,
max: i128,
) -> (Integer, bool)
fn discr_range_of_repr<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, max: i128, ) -> (Integer, bool)
Finds the appropriate Integer type and signedness for the given
signed discriminant range and #[repr] attribute.
N.B.: u128 values above i128::MAX will be treated as signed, but
that shouldn’t affect anything, other than maybe debuginfo.
This is the basis for computing the type of the tag of an enum (which can be smaller than
the type of the discriminant, which is determined by ReprOptions::discr_type).