pub struct AssetName(/* private fields */);Expand description
One asset’s name: a bare file name ending in an accepted image extension.
Validated wherever one is built, deserialized included: non-empty, no /, no \, no
.., no whitespace, control character or parenthesis — none of which a bare Markdown link
target can hold — and ending, case-insensitively, in .png, .jpg, .jpeg, .gif or
.webp after a non-empty stem. The name is kept exactly as written, case included: it is
the text a reference names and the file name a source stores the bytes under.
Implementations§
Source§impl AssetName
impl AssetName
Sourcepub fn new(name: impl Into<String>) -> Result<Self, String>
pub fn new(name: impl Into<String>) -> Result<Self, String>
One name, once it is established that it is one.
§Errors
A message naming the name and what is wrong with it, and what to write instead.
Sourcepub fn content_type(&self) -> AssetContentType
pub fn content_type(&self) -> AssetContentType
The content type its extension stores and serves it as.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AssetName
impl<'de> Deserialize<'de> for AssetName
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
impl Eq for AssetName
Source§impl JsonSchema for AssetName
impl JsonSchema for AssetName
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for AssetName
impl Ord for AssetName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for AssetName
impl PartialOrd for AssetName
impl StructuralPartialEq for AssetName
Auto Trait Implementations§
impl Freeze for AssetName
impl RefUnwindSafe for AssetName
impl Send for AssetName
impl Sync for AssetName
impl Unpin for AssetName
impl UnsafeUnpin for AssetName
impl UnwindSafe for AssetName
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