ingraph 0.1.0

A declaration-driven indexing framework: records and nodes are written as Rust types, and the storage rows, the dataflow between them and the GraphQL query surface are emitted from the declaration.
Documentation
//! The AUDIO track's codec seat.

use mediaframe::codec::AudioCodec as Foreign;

/// **What an audio track's bytes are encoded with** — an FFmpeg audio codec name in the lowercase
/// canon, or the open escape for one this build's roster does not carry.
///
/// The citizen wrapping [`mediaframe::codec::AudioCodec`]. It is [`VideoCodec`](super::VideoCodec)'s
/// sentence over a DIFFERENT roster, and the separate type is what keeps the difference: `aac` and
/// `opus` are values here and `h264` is not one an audio seat should be able to take, which a single
/// shared codec type could not say.
///
/// Everything the video citizen documents holds here word for word — the total door, the fold at
/// construction, the canonical-slug equality, the alphabetical order over spellings, the
/// re-canonicalising conversion from the upstream value. See [`VideoCodec`](super::VideoCodec),
/// where each is argued once, and the module note for the faces and the two refusals.
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct AudioCodec(Foreign);

impl AudioCodec {
  /// Read an audio codec name, WIDE — any case, known or not.
  ///
  /// The ONE door in, and it is total: a name the roster does not carry lands in the escape arm,
  /// ASCII-folded to the lowercase canon.
  #[inline]
  #[must_use]
  pub fn new(text: &str) -> Self {
    // `from_str` is `Infallible` upstream; the closure takes an uninhabited value, so there is no
    // panic path here. See `VideoCodec::new`, where the shape is explained.
    Self(text.parse().unwrap_or_else(|never| match never {}))
  }

  /// The wrapped upstream value, borrowed.
  #[inline]
  #[must_use]
  pub const fn get(&self) -> &Foreign {
    &self.0
  }

  /// The wrapped upstream value, owned. Canonical, the door having made it so.
  #[inline]
  #[must_use]
  pub fn into_inner(self) -> Foreign {
    self.0
  }

  /// The canonical slug — the text this value stores as, pages by, and crosses the wire as.
  #[inline]
  #[must_use]
  pub fn as_str(&self) -> &str {
    self.0.as_str()
  }

  /// Whether this build's roster CARRIES this codec, as against holding it in the open escape.
  ///
  /// The roster itself is
  /// [`mediaframe::codec::AudioCodec::ROSTER`](mediaframe::codec::AudioCodec#associatedconstant.ROSTER)
  /// and is not restated here.
  #[inline]
  #[must_use]
  pub fn is_registered(&self) -> bool {
    !self.0.is_other()
  }
}

super::codec_citizen!(
  AudioCodec,
  mediaframe::codec::AudioCodec,
  AudioCodecWire,
  "AudioCodecFilter"
);

#[cfg(test)]
mod tests;