pub struct VersionedApiDocFileName { /* private fields */ }Expand description
A versioned API document filename.
Versioned APIs can have multiple versions coexisting. The filename includes
the version and a content hash: {ident}/{ident}-{version}-{hash}.json (or
.json.gitstub for Git stub storage).
Implementations§
Source§impl VersionedApiDocFileName
impl VersionedApiDocFileName
Sourcepub fn new(ident: ApiIdent, version: Version, hash: String) -> Self
pub fn new(ident: ApiIdent, version: Version, hash: String) -> Self
Creates a new versioned API document filename (JSON format).
Sourcepub fn new_git_stub(ident: ApiIdent, version: Version, hash: String) -> Self
pub fn new_git_stub(ident: ApiIdent, version: Version, hash: String) -> Self
Creates a new versioned API document filename (Git stub format).
Sourcepub fn kind(&self) -> VersionedApiDocKind
pub fn kind(&self) -> VersionedApiDocKind
Returns the storage kind (JSON or Git stub).
Sourcepub fn is_git_stub(&self) -> bool
pub fn is_git_stub(&self) -> bool
Returns true if this is a Git stub.
Sourcepub fn path(&self) -> Utf8PathBuf
pub fn path(&self) -> Utf8PathBuf
Returns the path of this file relative to the root of the OpenAPI documents.
The path is always joined with a forward slash, including on Windows.
Sourcepub fn to_json(&self) -> Self
pub fn to_json(&self) -> Self
Converts this filename to its JSON equivalent.
If already JSON, returns a clone of self.
Sourcepub fn to_git_stub(&self) -> Self
pub fn to_git_stub(&self) -> Self
Converts this filename to its Git stub equivalent.
If already a Git stub, returns a clone of self.
Sourcepub fn git_stub_basename(&self) -> String
pub fn git_stub_basename(&self) -> String
Returns the basename as a Git stubname.
- If already a Git stub, returns
basename()directly. - If JSON, returns
basename() + ".gitstub".
Sourcepub fn json_basename(&self) -> String
pub fn json_basename(&self) -> String
Returns the basename as a JSON filename.
- If already JSON, returns
basename()directly. - If Git stub, returns the basename without
.gitstub.
Trait Implementations§
Source§impl Clone for VersionedApiDocFileName
impl Clone for VersionedApiDocFileName
Source§fn clone(&self) -> VersionedApiDocFileName
fn clone(&self) -> VersionedApiDocFileName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more