Struct harfbuzz_rs::Tag [−][src]
pub struct Tag(pub hb_tag_t);
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]
impl Tag
pub fn new(a: char, b: char, c: char, d: char) -> Self
[src]
pub fn new(a: char, b: char, c: char, d: char) -> Self
Create a Tag
from its four-char textual representation.
Examples
use harfbuzz_rs::Tag; let cmap_tag = Tag::new('c', 'm', 'a', 'p'); assert_eq!(cmap_tag.to_string(), "cmap")
Trait Implementations
impl Copy for Tag
[src]
impl Copy for Tag
impl Clone for Tag
[src]
impl Clone for Tag
fn clone(&self) -> Tag
[src]
fn clone(&self) -> Tag
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Hash for Tag
[src]
impl Hash for Tag
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Tag
[src]
impl PartialEq for Tag
fn eq(&self, other: &Tag) -> bool
[src]
fn eq(&self, other: &Tag) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Tag) -> bool
[src]
fn ne(&self, other: &Tag) -> bool
This method tests for !=
.
impl Eq for Tag
[src]
impl Eq for Tag
impl Debug for Tag
[src]
impl Debug for Tag
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Tag
[src]
impl Display for Tag
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl FromStr for Tag
[src]
impl FromStr for Tag
type Err = TagFromStrErr
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Tag, TagFromStrErr>
[src]
fn from_str(s: &str) -> Result<Tag, TagFromStrErr>
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);