feat: add is_empty method to richtext

This commit is contained in:
ThetaDev 2023-11-21 13:29:46 +01:00
parent 8458d878e7
commit 22deccb408
2 changed files with 30 additions and 0 deletions

View file

@ -72,6 +72,13 @@ pub trait ToMarkdown {
fn to_markdown_yt_host(&self, yt_host: &str) -> String;
}
impl RichText {
/// Returns `true` if the rich text contains no text components.
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
}
impl TextComponent {
/// Get the text from the component
pub fn get_text(&self) -> &str {