pub struct NodeContents {
pub content_list: Vec<JsonValue>,
}
Expand description
Struct which represents the contents inside of a node
Fields§
§content_list: Vec<JsonValue>
Implementations§
Source§impl NodeContents
Methods for NodeContents
impl NodeContents
Methods for NodeContents
Sourcepub fn new() -> NodeContents
pub fn new() -> NodeContents
Create a new empty NodeContents
Sourcepub fn add_text(&self, text: &str) -> NodeContents
pub fn add_text(&self, text: &str) -> NodeContents
Appends text to the end of the list of contents
Sourcepub fn add_url(&self, url: &str) -> NodeContents
pub fn add_url(&self, url: &str) -> NodeContents
Appends a url to the end of the list of contents
Sourcepub fn add_mention(&self, referenced_ship: &str) -> NodeContents
pub fn add_mention(&self, referenced_ship: &str) -> NodeContents
Appends a mention to another @p/ship to the end of the list of contents
Sourcepub fn add_code(&self, expression: &str, output: &str) -> NodeContents
pub fn add_code(&self, expression: &str, output: &str) -> NodeContents
Appends a code block to the end of the list of contents
Sourcepub fn from_json(json_contents: Vec<JsonValue>) -> NodeContents
pub fn from_json(json_contents: Vec<JsonValue>) -> NodeContents
Create a NodeContents
from a list of JsonValue
s
Sourcepub fn to_formatted_string(&self) -> String
pub fn to_formatted_string(&self) -> String
Convert the NodeContents
into a single String
that is formatted
for human reading.
Sourcepub fn to_formatted_words(&self) -> Vec<String>
pub fn to_formatted_words(&self) -> Vec<String>
Converts the NodeContents
into a String
that is formatted
for human reading, which is then split at every whitespace.
Useful for parsing a message.
Trait Implementations§
Source§impl Clone for NodeContents
impl Clone for NodeContents
Source§fn clone(&self) -> NodeContents
fn clone(&self) -> NodeContents
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for NodeContents
impl RefUnwindSafe for NodeContents
impl Send for NodeContents
impl Sync for NodeContents
impl Unpin for NodeContents
impl UnwindSafe for NodeContents
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