Struct stam::TextResourceBuilder
source · pub struct TextResourceBuilder { /* private fields */ }Implementations§
source§impl TextResourceBuilder
impl TextResourceBuilder
pub fn new() -> Self
pub fn from_txt_file(filename: &str, config: Config) -> Result<Self, StamError>
sourcepub fn from_file(filename: &str, config: Config) -> Result<Self, StamError>
pub fn from_file(filename: &str, config: Config) -> Result<Self, StamError>
Load a resource from file. The extension determines the type.
pub fn with_id(self, id: String) -> Self
pub fn with_filename(self, filename: &str) -> Self
pub fn with_text(self, text: String) -> Self
sourcepub fn build(self) -> Result<TextResource, StamError>
pub fn build(self) -> Result<TextResource, StamError>
Builds a new TextResource from [`TextResourceBuilder’], consuming the latter
Trait Implementations§
source§impl Debug for TextResourceBuilder
impl Debug for TextResourceBuilder
source§impl Default for TextResourceBuilder
impl Default for TextResourceBuilder
source§fn default() -> TextResourceBuilder
fn default() -> TextResourceBuilder
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for TextResourceBuilder
impl<'de> Deserialize<'de> for TextResourceBuilder
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> FromJson<'a> for TextResourceBuilder
impl<'a> FromJson<'a> for TextResourceBuilder
source§fn from_json_file(filename: &str, config: Config) -> Result<Self, StamError>
fn from_json_file(filename: &str, config: Config) -> Result<Self, StamError>
Loads a Text Resource from a STAM JSON or plain text file file.
If the file is JSON, it file must contain a single object which has “@type”: “TextResource”
If include is true, the file will be included via the @include mechanism, and is kept external upon serialization
source§impl TryFrom<TextResourceBuilder> for TextResource
impl TryFrom<TextResourceBuilder> for TextResource
Auto Trait Implementations§
impl RefUnwindSafe for TextResourceBuilder
impl Send for TextResourceBuilder
impl Sync for TextResourceBuilder
impl Unpin for TextResourceBuilder
impl UnwindSafe for TextResourceBuilder
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