pub struct VersionedApiSpecFileName { /* private fields */ }Expand description
A versioned API spec 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 VersionedApiSpecFileName
impl VersionedApiSpecFileName
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 spec 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 spec filename (Git stub format).
Sourcepub fn kind(&self) -> VersionedApiSpecKind
pub fn kind(&self) -> VersionedApiSpecKind
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.
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 VersionedApiSpecFileName
impl Clone for VersionedApiSpecFileName
Source§fn clone(&self) -> VersionedApiSpecFileName
fn clone(&self) -> VersionedApiSpecFileName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VersionedApiSpecFileName
impl Debug for VersionedApiSpecFileName
Source§impl Display for VersionedApiSpecFileName
impl Display for VersionedApiSpecFileName
Source§impl From<VersionedApiSpecFileName> for ApiSpecFileName
impl From<VersionedApiSpecFileName> for ApiSpecFileName
Source§fn from(v: VersionedApiSpecFileName) -> Self
fn from(v: VersionedApiSpecFileName) -> Self
Source§impl Ord for VersionedApiSpecFileName
impl Ord for VersionedApiSpecFileName
Source§fn cmp(&self, other: &VersionedApiSpecFileName) -> Ordering
fn cmp(&self, other: &VersionedApiSpecFileName) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for VersionedApiSpecFileName
impl PartialEq for VersionedApiSpecFileName
Source§fn eq(&self, other: &VersionedApiSpecFileName) -> bool
fn eq(&self, other: &VersionedApiSpecFileName) -> bool
self and other values to be equal, and is used by ==.