pub struct StaticResource { /* private fields */ }Expand description
A static resource that returns fixed content.
Implementations§
Source§impl StaticResource
impl StaticResource
Sourcepub fn new_text(uri: impl Into<String>, content: impl Into<String>) -> Self
pub fn new_text(uri: impl Into<String>, content: impl Into<String>) -> Self
Create a new static resource with URI and text content.
Sourcepub fn new_image(
uri: impl Into<String>,
data: &[u8],
mime_type: impl Into<String>,
) -> Self
pub fn new_image( uri: impl Into<String>, data: &[u8], mime_type: impl Into<String>, ) -> Self
Create a new static resource with URI and image content.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the resource description.
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
Set the MIME type.
Sourcepub fn info(&self) -> ResourceInfo
pub fn info(&self) -> ResourceInfo
Get the resource info.
Trait Implementations§
Source§impl Clone for StaticResource
impl Clone for StaticResource
Source§fn clone(&self) -> StaticResource
fn clone(&self) -> StaticResource
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 StaticResource
impl RefUnwindSafe for StaticResource
impl Send for StaticResource
impl Sync for StaticResource
impl Unpin for StaticResource
impl UnwindSafe for StaticResource
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