pub struct ProgramName { /* private fields */ }Expand description
A program’s name.
Sixteen characters at most, printable ASCII, and no terminator: the terminator belongs to the field a name is stored in, not to the name.
use deepmind_midi::program::ProgramName;
let name = ProgramName::new("Bass Sweep")?;
assert_eq!(name.as_str(), "Bass Sweep");
assert_eq!(name.to_string(), "Bass Sweep");
assert!(ProgramName::new("Seventeen Charact").is_err());
assert!(ProgramName::new("Caffè").is_err());Implementations§
Source§impl ProgramName
impl ProgramName
Sourcepub fn new(text: &str) -> Result<Self>
pub fn new(text: &str) -> Result<Self>
Builds a name from a string.
§Errors
Returns Error::ProgramNameTooLong past ProgramName::MAX_CHARS and
Error::ProgramNameCharacter for a character the synthesizer’s display
has no glyph for, which is anything but printable ASCII.
Trait Implementations§
Source§impl AsRef<str> for ProgramName
impl AsRef<str> for ProgramName
Source§impl Clone for ProgramName
impl Clone for ProgramName
impl Copy for ProgramName
Source§impl Debug for ProgramName
impl Debug for ProgramName
Source§impl Default for ProgramName
impl Default for ProgramName
Source§impl<'de> Deserialize<'de> for ProgramName
Available on crate feature serde only.Deserializes from a string, through ProgramName::new, so the length
and character rules hold for a name that came out of a file too.
impl<'de> Deserialize<'de> for ProgramName
Available on crate feature
serde only.Deserializes from a string, through ProgramName::new, so the length
and character rules hold for a name that came out of a file too.
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ProgramName
impl Display for ProgramName
impl Eq for ProgramName
Source§impl FromStr for ProgramName
impl FromStr for ProgramName
Source§impl Hash for ProgramName
impl Hash for ProgramName
Source§impl Ord for ProgramName
impl Ord for ProgramName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ProgramName
impl PartialEq for ProgramName
Source§impl PartialOrd for ProgramName
impl PartialOrd for ProgramName
Source§impl Serialize for ProgramName
Available on crate feature serde only.Serializes as the string it displays as, so "Bass Sweep" is the whole of
it in any format.
impl Serialize for ProgramName
Available on crate feature
serde only.Serializes as the string it displays as, so "Bass Sweep" is the whole of
it in any format.
impl StructuralPartialEq for ProgramName
Auto Trait Implementations§
impl Forget for ProgramName
impl Freeze for ProgramName
impl Move for ProgramName
impl RefUnwindSafe for ProgramName
impl Send for ProgramName
impl Sync for ProgramName
impl Unpin for ProgramName
impl UnsafeUnpin for ProgramName
impl UnwindSafe for ProgramName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more