pub enum Dir {
Ltr,
Rtl,
Auto,
}Expand description
The dir attribute values for text directionality.
§Purpose
Controls the text directionality of an element’s content, which is critical for proper rendering of multilingual content and right-to-left languages.
§Usage Context
- Used with: All HTML elements (global attribute)
- Affects: Text rendering direction, visual layout, and text alignment
§Valid Values
Ltr: Left-to-right text direction (default for most languages)Rtl: Right-to-left text direction (for languages like Arabic, Hebrew)Auto: Browser determines direction based on content
§Example
use ironhtml_attributes::{AttributeValue, Dir};
let direction = Dir::Rtl;
assert_eq!(direction.to_attr_value(), "rtl");<p dir="rtl">مرحبا بك</p>
<p dir="ltr">Hello world</p>
<p dir="auto">Auto-detected text</p>§WHATWG Specification
Variants§
Ltr
Left-to-right text direction, used for most Western languages (English, Spanish, French, etc.).
Rtl
Right-to-left text direction, used for languages like Arabic, Hebrew, Persian, and Urdu.
Auto
Automatically determines text direction based on the first strongly-typed directional character in the content.
Trait Implementations§
Source§impl AttributeValue for Dir
impl AttributeValue for Dir
Source§fn to_attr_value(&self) -> Cow<'static, str>
fn to_attr_value(&self) -> Cow<'static, str>
Convert to the attribute value string.
impl Copy for Dir
impl Eq for Dir
impl StructuralPartialEq for Dir
Auto Trait Implementations§
impl Freeze for Dir
impl RefUnwindSafe for Dir
impl Send for Dir
impl Sync for Dir
impl Unpin for Dir
impl UnwindSafe for Dir
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more