Skip to main content

Entity

Enum Entity 

Source
pub enum Entity {
Show 17 variants Cne3(Cne3), Live(Live), Midi(Midi), OrganPreset(OrganPreset), Piano(Piano), PianoLibrary(Cbin<RawBody>), PianoPreset(PianoPreset), PipeLibrary(Cbin<RawBody>), Performance(Performance), Program(Program), Sample(Sample), SampleProject(Project), Settings(Settings), Song(Song), Synth(Synth), Sysex(Sysex), Bundle(Bundle),
}
Expand description

One decoded file.

The decoded program variants are much the largest: a decoded panel holds its fields and the bytes it came from. Left unboxed — one of these exists per file being read, never in a collection.

Variants§

§

Cne3(Cne3)

An Electro 2 sample library — the one non-CBIN library format.

§

Live(Live)

§

Midi(Midi)

A MIDI carrier for a Lead SysEx bank, verbatim.

§

OrganPreset(OrganPreset)

§

Piano(Piano)

A piano library (npno).

§

PianoLibrary(Cbin<RawBody>)

A Stage Classic piano library (nsp). ⚠️ Megabytes, allocated whole — cbin::inspect answers container questions in O(1).

§

PianoPreset(PianoPreset)

§

PipeLibrary(Cbin<RawBody>)

A C2 pipe-organ library (npip). Same caution as Entity::PianoLibrary.

§

Performance(Performance)

§

Program(Program)

§

Sample(Sample)

§

SampleProject(Project)

A Nord Sample Editor project (.nsmpproj) — the text file the editor saves and generates an nsmp from.

§

Settings(Settings)

§

Song(Song)

§

Synth(Synth)

§

Sysex(Sysex)

A Lead 1/2/2X/3 SysEx dump, verbatim.

§

Bundle(Bundle)

Implementations§

Source§

impl Entity

Source

pub fn raw(&self) -> Option<&Cbin<RawBody>>

The container of a stub-backed entity — every variant whose body is container-verified but undecoded. None for the decoded formats and the non-CBIN carriers.

Source

pub fn registry(&self) -> Option<&dyn Registry>

The generated field registry behind this entity, for reading. None for the container-verified stubs and the non-panel carriers.

Source

pub fn registry_mut(&mut self) -> Option<&mut dyn Registry>

The registry again, for setting fields. The same bodies answer both: a body that lists its fields but refuses to set them cannot be declared here.

Source

pub fn identity(&self) -> Identity

The entity’s Identity: its human label and the tag its file carries.

Source

pub fn write_to(&self, w: &mut (impl Write + Seek)) -> Result<(), Error>

Re-encode to w, byte-exact for anything read and unedited.

Bundles are the one exception: the archive layer does not re-encode, so a bundle refuses rather than writing something almost like its source.

Trait Implementations§

Source§

impl Debug for Entity

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.