Trait bevy_internal::utils::smallvec::alloc::fmt::LowerHex

1.0.0 · source ·
pub trait LowerHex {
    // Required method
    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
}
Expand description

x formatting.

The LowerHex trait should format its output as a number in hexadecimal, with a through f in lower case.

For primitive signed integers (i8 to i128, and isize), negative values are formatted as the two’s complement representation.

The alternate flag, #, adds a 0x in front of the output.

For more information on formatters, see the module-level documentation.

Examples

Basic usage with i32:

let x = 42; // 42 is '2a' in hex

assert_eq!(format!("{x:x}"), "2a");
assert_eq!(format!("{x:#x}"), "0x2a");

assert_eq!(format!("{:x}", -16), "fffffff0");

Implementing LowerHex on a type:

use std::fmt;

struct Length(i32);

impl fmt::LowerHex for Length {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let val = self.0;

        fmt::LowerHex::fmt(&val, f) // delegate to i32's implementation
    }
}

let l = Length(9);

assert_eq!(format!("l as hex is: {l:x}"), "l as hex is: 9");

assert_eq!(format!("l as hex is: {l:#010x}"), "l as hex is: 0x00000009");

Required Methods§

source

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

Formats the value using the given formatter.

Implementors§

source§

impl LowerHex for i8

source§

impl LowerHex for i16

source§

impl LowerHex for i32

source§

impl LowerHex for i64

source§

impl LowerHex for i128

source§

impl LowerHex for isize

source§

impl LowerHex for u8

source§

impl LowerHex for u16

source§

impl LowerHex for u32

source§

impl LowerHex for u64

source§

impl LowerHex for u128

source§

impl LowerHex for usize

source§

impl LowerHex for alsa::poll::Flags

source§

impl LowerHex for PortCap

source§

impl LowerHex for PortType

source§

impl LowerHex for Remove

source§

impl LowerHex for UsageFlags

source§

impl LowerHex for AllocationFlags

source§

impl LowerHex for MemoryPropertyFlags

source§

impl LowerHex for DescriptorSetLayoutCreateFlags

source§

impl LowerHex for DescriptorPoolCreateFlags

source§

impl LowerHex for EventMask

source§

impl LowerHex for WatchMask

source§

impl LowerHex for ChannelTypeQualifiers

source§

impl LowerHex for DataFormatFlags

source§

impl LowerHex for naga::back::glsl::features::Features

source§

impl LowerHex for naga::back::glsl::WriterFlags

source§

impl LowerHex for ImageTypeFlags

source§

impl LowerHex for naga::back::spv::WriterFlags

source§

impl LowerHex for RayFlag

source§

impl LowerHex for naga::back::wgsl::writer::WriterFlags

source§

impl LowerHex for Barrier

source§

impl LowerHex for StorageAccess

source§

impl LowerHex for GlobalUse

source§

impl LowerHex for UniformityRequirements

source§

impl LowerHex for Capabilities

source§

impl LowerHex for naga::valid::ShaderStages

source§

impl LowerHex for ValidationFlags

source§

impl LowerHex for TypeFlags

source§

impl LowerHex for nix::fcntl::AtFlags

source§

impl LowerHex for nix::fcntl::FallocateFlags

source§

impl LowerHex for FdFlag

source§

impl LowerHex for OFlag

source§

impl LowerHex for nix::fcntl::RenameFlags

source§

impl LowerHex for SealFlag

source§

impl LowerHex for MntFlags

source§

impl LowerHex for MsFlags

source§

impl LowerHex for CloneFlags

source§

impl LowerHex for EpollCreateFlags

source§

impl LowerHex for EpollFlags

source§

impl LowerHex for EfdFlags

source§

impl LowerHex for MemFdCreateFlag

source§

impl LowerHex for SaFlags

source§

impl LowerHex for SfdFlags

source§

impl LowerHex for nix::sys::stat::Mode

source§

impl LowerHex for SFlag

source§

impl LowerHex for FsFlags

source§

impl LowerHex for WaitPidFlag

source§

impl LowerHex for AccessFlags

source§

impl LowerHex for Transformations

source§

impl LowerHex for rustix::backend::event::epoll::CreateFlags

source§

impl LowerHex for EventFlags

source§

impl LowerHex for PollFlags

source§

impl LowerHex for EventfdFlags

source§

impl LowerHex for rustix::backend::fs::inotify::CreateFlags

source§

impl LowerHex for WatchFlags

source§

impl LowerHex for Access

source§

impl LowerHex for rustix::backend::fs::types::AtFlags

source§

impl LowerHex for rustix::backend::fs::types::FallocateFlags

source§

impl LowerHex for MemfdFlags

source§

impl LowerHex for rustix::backend::fs::types::Mode

source§

impl LowerHex for OFlags

source§

impl LowerHex for rustix::backend::fs::types::RenameFlags

source§

impl LowerHex for ResolveFlags

source§

impl LowerHex for SealFlags

source§

impl LowerHex for StatVfsMountFlags

source§

impl LowerHex for StatxFlags

source§

impl LowerHex for DupFlags

source§

impl LowerHex for FdFlags

source§

impl LowerHex for ReadWriteFlags

source§

impl LowerHex for MountFlags

source§

impl LowerHex for MountPropagationFlags

source§

impl LowerHex for UnmountFlags

source§

impl LowerHex for RecvFlags

source§

impl LowerHex for SendFlags

source§

impl LowerHex for PipeFlags

source§

impl LowerHex for SpliceFlags

source§

impl LowerHex for ShmOFlags

source§

impl LowerHex for FutexFlags

source§

impl LowerHex for TimerfdFlags

source§

impl LowerHex for TimerfdTimerFlags

source§

impl LowerHex for IFlags

source§

impl LowerHex for XattrFlags

source§

impl LowerHex for SocketFlags

source§

impl LowerHex for SockaddrXdpFlags

source§

impl LowerHex for XdpDescOptions

source§

impl LowerHex for XdpOptionsFlags

source§

impl LowerHex for XdpRingFlags

source§

impl LowerHex for XdpUmemRegFlags

source§

impl LowerHex for MembarrierQuery

source§

impl LowerHex for PidfdFlags

source§

impl LowerHex for PidfdGetfdFlags

source§

impl LowerHex for FloatingPointEmulationControl

source§

impl LowerHex for FloatingPointExceptionMode

source§

impl LowerHex for SpeculationFeatureControl

source§

impl LowerHex for SpeculationFeatureState

source§

impl LowerHex for UnalignedAccessControl

source§

impl LowerHex for WaitOptions

source§

impl LowerHex for WaitidOptions

source§

impl LowerHex for CapabilityFlags

source§

impl LowerHex for CapabilitiesSecureBits

source§

impl LowerHex for TaggedAddressMode

source§

impl LowerHex for ThreadNameSpaceType

source§

impl LowerHex for UnshareFlags

source§

impl LowerHex for smithay_client_toolkit::shell::wlr_layer::Anchor

source§

impl LowerHex for CooperativeMatrixOperands

source§

impl LowerHex for FPFastMathMode

source§

impl LowerHex for FragmentShadingRate

source§

impl LowerHex for FunctionControl

source§

impl LowerHex for ImageOperands

source§

impl LowerHex for KernelProfilingInfo

source§

impl LowerHex for LoopControl

source§

impl LowerHex for MemoryAccess

source§

impl LowerHex for MemorySemantics

source§

impl LowerHex for RayFlags

source§

impl LowerHex for SelectionControl

source§

impl LowerHex for Braced

source§

impl LowerHex for Hyphenated

source§

impl LowerHex for Simple

source§

impl LowerHex for Urn

source§

impl LowerHex for DndAction

source§

impl LowerHex for wayland_client::protocol::wl_output::Mode

source§

impl LowerHex for wayland_client::protocol::wl_seat::Capability

source§

impl LowerHex for Resize

source§

impl LowerHex for Transient

source§

impl LowerHex for WindowManagerCapabilities

source§

impl LowerHex for WindowState

source§

impl LowerHex for wayland_protocols::wp::linux_dmabuf::zv1::generated::client::zwp_linux_buffer_params_v1::Flags

source§

impl LowerHex for TrancheFlags

source§

impl LowerHex for Kind

source§

impl LowerHex for wayland_protocols::wp::text_input::zv1::generated::client::zwp_text_input_v1::ContentHint

source§

impl LowerHex for wayland_protocols::wp::text_input::zv3::generated::client::zwp_text_input_v3::ContentHint

source§

impl LowerHex for ConstraintAdjustment

source§

impl LowerHex for wayland_protocols_plasma::output_device::v1::generated::client::org_kde_kwin_outputdevice::Capability

source§

impl LowerHex for wayland_protocols_plasma::output_device::v2::generated::client::kde_output_device_v2::Capability

source§

impl LowerHex for wayland_protocols_plasma::text_input::v2::generated::client::zwp_text_input_v2::ContentHint

source§

impl LowerHex for wayland_protocols_wlr::layer_shell::v1::generated::client::zwlr_layer_surface_v1::Anchor

source§

impl LowerHex for wayland_protocols_wlr::screencopy::v1::generated::client::zwlr_screencopy_frame_v1::Flags

source§

impl LowerHex for PipelineFlags

source§

impl LowerHex for AccelerationStructureUses

source§

impl LowerHex for AttachmentOps

source§

impl LowerHex for BindGroupLayoutFlags

source§

impl LowerHex for BufferUses

source§

impl LowerHex for FormatAspects

source§

impl LowerHex for MemoryFlags

source§

impl LowerHex for PipelineLayoutFlags

source§

impl LowerHex for TextureFormatCapabilities

source§

impl LowerHex for TextureUses

source§

impl LowerHex for Workarounds

source§

impl LowerHex for AccelerationStructureFlags

source§

impl LowerHex for AccelerationStructureGeometryFlags

source§

impl LowerHex for DownlevelFlags

source§

impl LowerHex for PipelineStatisticsTypes

source§

impl LowerHex for TextureFormatFeatureFlags

source§

impl LowerHex for ModifiersState

source§

impl LowerHex for WindowButtons

source§

impl LowerHex for xkb_state_component

source§

impl LowerHex for bevy_internal::pbr::MeshFlags

source§

impl LowerHex for MeshPipelineKey

source§

impl LowerHex for MeshPipelineViewLayoutKey

source§

impl LowerHex for StandardMaterialFlags

source§

impl LowerHex for RenderAssetUsages

source§

impl LowerHex for BufferUsages

source§

impl LowerHex for ColorWrites

source§

impl LowerHex for bevy_internal::render::render_resource::ShaderStages

source§

impl LowerHex for TextureUsages

source§

impl LowerHex for Backends

source§

impl LowerHex for InstanceFlags

source§

impl LowerHex for bevy_internal::render::settings::WgpuFeatures

source§

impl LowerHex for CompressedImageFormats

source§

impl LowerHex for Extensions

source§

impl LowerHex for ColorMaterialFlags

source§

impl LowerHex for Mesh2dPipelineKey

source§

impl LowerHex for bevy_internal::sprite::MeshFlags

source§

impl LowerHex for SpritePipelineKey

source§

impl LowerHex for NonMaxI8

source§

impl LowerHex for NonMaxI16

source§

impl LowerHex for NonMaxI32

source§

impl LowerHex for NonMaxI64

source§

impl LowerHex for NonMaxI128

source§

impl LowerHex for NonMaxIsize

source§

impl LowerHex for NonMaxU8

source§

impl LowerHex for NonMaxU16

source§

impl LowerHex for NonMaxU32

source§

impl LowerHex for NonMaxU64

source§

impl LowerHex for NonMaxU128

source§

impl LowerHex for NonMaxUsize

source§

impl LowerHex for Uuid

1.34.0 · source§

impl LowerHex for NonZeroI8

1.34.0 · source§

impl LowerHex for NonZeroI16

1.34.0 · source§

impl LowerHex for NonZeroI32

1.34.0 · source§

impl LowerHex for NonZeroI64

1.34.0 · source§

impl LowerHex for NonZeroI128

1.34.0 · source§

impl LowerHex for NonZeroIsize

1.28.0 · source§

impl LowerHex for NonZeroU8

1.28.0 · source§

impl LowerHex for NonZeroU16

1.28.0 · source§

impl LowerHex for NonZeroU32

1.28.0 · source§

impl LowerHex for NonZeroU64

1.28.0 · source§

impl LowerHex for NonZeroU128

1.28.0 · source§

impl LowerHex for NonZeroUsize

source§

impl<'s, T> LowerHex for SliceVec<'s, T>
where T: LowerHex,

source§

impl<A> LowerHex for TinyVec<A>
where A: Array, <A as Array>::Item: LowerHex,

source§

impl<A> LowerHex for ArrayVec<A>
where A: Array, <A as Array>::Item: LowerHex,

source§

impl<T> LowerHex for &T
where T: LowerHex + ?Sized,

source§

impl<T> LowerHex for &mut T
where T: LowerHex + ?Sized,

1.74.0 · source§

impl<T> LowerHex for Saturating<T>
where T: LowerHex,

1.11.0 · source§

impl<T> LowerHex for Wrapping<T>
where T: LowerHex,