cp437_tools::prelude

Struct Meta

Source
pub struct Meta {
    pub title: String,
    pub author: String,
    pub group: String,
    pub date: String,
    pub size: u32,
    pub type: (u8, u8),
    pub width: u16,
    pub height: u16,
    pub flags: u8,
    pub font: String,
    pub notes: Vec<String>,
}
Expand description

A structure representing a file’s metadata

Fields§

§title: String

The image’s title

§author: String

The image’s author

§group: String

The image author’s team or group

§date: String

The image creation date, in the YYYYMMDD format

§size: u32

The size of the file, sans this metadata

§type: (u8, u8)

The type of this file

Only supported values are

  • (0, 0)None (effectively, Character/ANSI)
  • (1, 0)Character/ASCII
  • (1, 1)Character/ANSI

See https://www.acid.org/info/sauce/sauce.htm#FileType

§width: u16

Width of the image

§height: u16

Height of the image

§flags: u8

A bitfield of flags that define how to process an image

See https://www.acid.org/info/sauce/sauce.htm#ANSiFlags

§font: String

The name of the font this image uses

Only IBM VGA is supported.

§notes: Vec<String>

A list of comments on this image

Implementations§

Source§

impl Meta

Source

pub fn title(&self) -> Option<&String>

Wrap the title in an Option.

See title field

Source

pub fn author(&self) -> Option<&String>

Wrap the author in an Option.

See author field

Source

pub fn group(&self) -> Option<&String>

Wrap the group in an Option.

See group field

Source

pub fn date(&self) -> Option<&String>

Wrap the date in an Option.

See date field

Source

pub fn size(&self) -> u32

Fetch the size.

See size field

Source

pub fn type(&self) -> (u8, u8)

Fetch the type if type != (0, 0), otherwise the default.

See type field

See Meta::default

Source

pub fn width(&self) -> u16

Fetch the width if width > 0, otherwise the default.

See width field

See Meta::default

Source

pub fn height(&self) -> u16

Fetch the height if height > 0, otherwise the default.

See height field

See Meta::default

Source

pub fn dimensions(&self) -> (u16, u16)

Get both the width and the height.

See width method

See height method

Source

pub fn flags(&self) -> (u8, u8, u8)

Fetch the flags, split into (AR, LS, B).

See flags field

Source

pub fn font(&self) -> Option<&String>

Fetch the font if font != "", otherwise the default.

See font field

Source

pub fn font_face_otb(&self) -> &Face<'_>

Font face, in OTB format.

See font field

Source

pub fn font_face_woff(&self) -> &[u8]

Font face, in WOFF format.

See font field

Source

pub fn notes(&self) -> &Vec<String>

Fetch the notes.

See notes field

Source

pub fn stretch(&self) -> f64

Compute the stretch required for a given aspect ratio.

See aspect_ratio method

Source

pub fn aspect_ratio(&self) -> (u8, u8)

Compute the aspect ratio.

See flags field

Source

pub fn font_width(&self) -> u8

Font width.

See flags field

Source

pub fn font_height(&self) -> u8

Font height.

Source

pub fn font_size(&self) -> (u8, u8)

Font dimensions.

See font_width method

See font_height method

Trait Implementations§

Source§

impl Clone for Meta

Source§

fn clone(&self) -> Meta

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Meta

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Meta

A minimal meta

Sets all defaults as interpreted when undefined

Source§

fn default() -> Meta

Get default meta values

Source§

impl PartialEq for Meta

Source§

fn eq(&self, other: &Meta) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Meta

Source§

impl StructuralPartialEq for Meta

Auto Trait Implementations§

§

impl Freeze for Meta

§

impl RefUnwindSafe for Meta

§

impl Send for Meta

§

impl Sync for Meta

§

impl Unpin for Meta

§

impl UnwindSafe for Meta

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.