Trait StringFormat

Source
pub trait StringFormat {
    type Unit;

    // Required methods
    unsafe fn release(entry: &*const Self::Unit);
    fn is_valid(is_wide: bool);
}
Expand description

The StringFormat trait defines the methods required to interact with a specific string format type.

This includes the type of unit (e.g., u8 for c_char or u16 for w_char_t) and methods for validation and releasing memory associated with entries.

Required Associated Types§

Source

type Unit

U8/U16

Required Methods§

Source

unsafe fn release(entry: &*const Self::Unit)

Releases the entry associated with the string format type.

§Safety
  • The caller must ensure the entry is valid and allocated.
  • Not having a double free.
Source

fn is_valid(is_wide: bool)

Validates the entry, ensuring the proper string format (e.g., UTF-8 or UTF-16).

§Panics

If the format does not match the expected type (wide or not), this function will panic.

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.

Implementors§