Implement const default function for AssetPath
This commit is contained in:
parent
9e8ef188f8
commit
6557e2ceee
1 changed files with 8 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt::Display, path::Path, str::FromStr};
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
|
||||
pub struct AssetPath {
|
||||
#[serde(skip)]
|
||||
prefix: Option<String>,
|
||||
|
@ -10,6 +10,13 @@ pub struct AssetPath {
|
|||
}
|
||||
|
||||
impl AssetPath {
|
||||
pub const fn default() -> Self {
|
||||
Self {
|
||||
prefix: None,
|
||||
path: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn check_prefix(prefix: &str) -> String {
|
||||
if prefix.ends_with('/') {
|
||||
prefix.to_string()
|
||||
|
|
Loading…
Reference in a new issue