[−][src]Struct harfbuzz_rs::Tag
A type to represent 4-byte SFNT tags.
Tables, features, etc. in OpenType and many other font formats use SFNT tags
as identifiers. These are 4-bytes long and usually each byte represents an
ASCII value. Tag
provides methods to create such identifiers from
individual chars
or a str
slice and to get the string representation of
a Tag
.
Methods
impl Tag
[src]
pub const fn new(a: char, b: char, c: char, d: char) -> Self
[src]
Create a Tag
from its four-char textual representation.
All the arguments must be ASCII values.
Examples
use harfbuzz_rs::Tag; let cmap_tag = Tag::new('c', 'm', 'a', 'p'); assert_eq!(cmap_tag.to_string(), "cmap")
pub const fn to_bytes(self) -> [u8; 4]
[src]
Returns tag as 4-element byte array.
Examples
let tag = Tag::new('a', 'b', 'c', 'd'); assert_eq!(&tag.to_bytes(), b"abcd");
Trait Implementations
impl Eq for Tag
[src]
impl Clone for Tag
[src]
fn clone(&self) -> Tag
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Tag
[src]
impl PartialEq<Tag> for Tag
[src]
impl Hash for Tag
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Tag
[src]
impl Display for Tag
[src]
impl FromStr for Tag
[src]
type Err = TagFromStrErr
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Tag, TagFromStrErr>
[src]
Parses a Tag
from a &str
that contains four or less ASCII
characters. When the string's length is smaller than 4 it is extended
with ' '
(Space) characters. The remaining bytes of strings longer
than 4 bytes are ignored.
Examples
use harfbuzz_rs::Tag; use std::str::FromStr; let tag1 = Tag::from_str("ABCD").unwrap(); let tag2 = Tag::new('A', 'B', 'C', 'D'); assert_eq!(tag1, tag2);
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,