pub struct Text { /* private fields */ }Expand description
One piece of text a score says about itself: music21’s
metadata.Text. It keeps the language it is written in, whether it is a
translation, and the scheme it was encoded by.
use music21::metadata::primitives::Text;
let title = Text::new("concerto in d").in_language("en");
assert_eq!(title.to_string(), "concerto in d");
assert_eq!(title.language(), Some("en"));Implementations§
Source§impl Text
impl Text
Sourcepub fn is_translated(&self) -> Option<bool>
pub fn is_translated(&self) -> Option<bool>
Whether it is a translation, where it says. Nothing at all means nobody has said.
Sourcepub fn encoding_scheme(&self) -> Option<&str>
pub fn encoding_scheme(&self) -> Option<&str>
The scheme it was encoded by, where it says.
Sourcepub fn in_language(self, language: impl Into<String>) -> Self
pub fn in_language(self, language: impl Into<String>) -> Self
The same text, said to be in a language.
Sourcepub fn translated(self, is_translated: bool) -> Self
pub fn translated(self, is_translated: bool) -> Self
The same text, said to be a translation or not.
Sourcepub fn encoded_by(self, scheme: impl Into<String>) -> Self
pub fn encoded_by(self, scheme: impl Into<String>) -> Self
The same text, said to be encoded by a scheme.
Sourcepub fn in_role(self, role: impl Into<String>) -> Self
pub fn in_role(self, role: impl Into<String>) -> Self
The same text, given a role: music21’s Copyright.
Sourcepub fn set_language(&mut self, language: Option<String>)
pub fn set_language(&mut self, language: Option<String>)
Says what language it is in.
Sourcepub fn set_translated(&mut self, is_translated: Option<bool>)
pub fn set_translated(&mut self, is_translated: Option<bool>)
Says whether it is a translation.
Sourcepub fn set_encoding_scheme(&mut self, scheme: Option<String>)
pub fn set_encoding_scheme(&mut self, scheme: Option<String>)
Says what scheme it was encoded by.
Sourcepub fn normalized_article(&self) -> Result<String>
pub fn normalized_article(&self) -> Result<String>
The text with the article put back at the front, where the language
is one whose articles are moved: music21’s getNormalizedArticle,
which is text::prepend_article.
§Errors
A language whose articles are not known.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Text
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Text
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Text
Source§impl Ord for Text
impl Ord for Text
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Text
impl PartialOrd for Text
impl StructuralPartialEq for Text
Auto Trait Implementations§
impl Forget for Text
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
impl UnwindSafe for Text
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more