CharacterFormat

Enum CharacterFormat 

Source
pub enum CharacterFormat {
    Ascii,
    Ansi,
    AnsiMation,
    RipScript,
    PCBoard,
    Avatar,
    Html,
    Source,
    TundraDraw,
    Unknown(u8),
}
Expand description

Character format types as specified in the SAUCE v00 specification.

Each format represents a different text or graphics encoding standard used by the BBS and retro computing community. The numeric values correspond to the FileType field in the SAUCE header.

Variants§

§

Ascii

Plain ASCII text (value 0)

§

Ansi

ANSI escape sequence art (value 1)

§

AnsiMation

ANSI with animation/timing (value 2)

§

RipScript

Remote Imaging Protocol - pixel-based graphics (value 3)

§

PCBoard

PCBoard BBS format (value 4)

§

Avatar

Avatar graphics format (value 5)

§

Html

Hypertext Markup Language (value 6)

§

Source

Generic source code (value 7)

§

TundraDraw

TundraDraw format (value 8)

§

Unknown(u8)

Unknown or unsupported format (preserves raw value)

Implementations§

Source§

impl CharacterFormat

Source

pub fn from_sauce(file_type: u8) -> Self

Parse a character format from the SAUCE FileType byte.

§Arguments
  • file_type - The 8-bit FileType value from the SAUCE header
§Returns

Returns the corresponding CharacterFormat, or CharacterFormat::Unknown if the value is not recognized.

§Example
use icy_sauce::CharacterFormat;
let format = CharacterFormat::from_sauce(1);
assert_eq!(format, CharacterFormat::Ansi);
Source

pub fn to_sauce(&self) -> u8

Convert to the SAUCE FileType byte representation.

§Returns

The 8-bit FileType value suitable for writing to a SAUCE header.

§Example
use icy_sauce::CharacterFormat;
assert_eq!(CharacterFormat::Ansi.to_sauce(), 1);
assert_eq!(CharacterFormat::Unknown(99).to_sauce(), 99);
Source

pub fn supports_ansi_flags(&self) -> bool

Check if this format supports ANSI flags (ice colors, letter spacing, aspect ratio).

Only ASCII, ANSI, and ANSiMation formats support the extended rendering options stored in the TFlags byte of the SAUCE header.

§Example
use icy_sauce::CharacterFormat;
assert!(CharacterFormat::Ansi.supports_ansi_flags());
assert!(!CharacterFormat::Html.supports_ansi_flags());
Source

pub fn has_dimensions(&self) -> bool

Check if this format stores character grid dimensions (width/height).

Most formats store character dimensions in TInfo1 (width) and TInfo2 (height), except HTML and Source which have variable dimensions.

§Example
use icy_sauce::CharacterFormat;
assert!(CharacterFormat::Ansi.has_dimensions());
assert!(!CharacterFormat::Html.has_dimensions());
Source

pub fn is_stream(&self) -> bool

Check if this format is a streaming format with variable height.

Streaming formats can have content of any height, unlike fixed-size animations. RIPScript and HTML are not considered streaming despite being variable-height.

§Example
use icy_sauce::CharacterFormat;
assert!(CharacterFormat::Ansi.is_stream());
assert!(!CharacterFormat::AnsiMation.is_stream());
Source

pub fn is_animation(&self) -> bool

Check if this format is an animation that requires fixed screen dimensions.

ANSiMation requires both width and height to be fixed for proper playback timing.

§Example
use icy_sauce::CharacterFormat;
assert!(CharacterFormat::AnsiMation.is_animation());
assert!(!CharacterFormat::Ansi.is_animation());

Trait Implementations§

Source§

impl Clone for CharacterFormat

Source§

fn clone(&self) -> CharacterFormat

Returns a duplicate 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 CharacterFormat

Source§

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

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

impl PartialEq for CharacterFormat

Source§

fn eq(&self, other: &CharacterFormat) -> 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 Copy for CharacterFormat

Source§

impl StructuralPartialEq for CharacterFormat

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> 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.