pub enum ApiSpecFileName {
Lockstep(LockstepApiSpecFileName),
Versioned(VersionedApiSpecFileName),
}Expand description
Describes the path to an OpenAPI document file, relative to some root where similar documents are found.
Variants§
Lockstep(LockstepApiSpecFileName)
A lockstep API: single OpenAPI document, no versioning.
Versioned(VersionedApiSpecFileName)
A versioned API: multiple versions can coexist.
Implementations§
Source§impl ApiSpecFileName
impl ApiSpecFileName
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 version(&self) -> Option<&Version>
pub fn version(&self) -> Option<&Version>
For versioned APIs, returns the version part of the filename.
Sourcepub fn is_git_stub(&self) -> bool
pub fn is_git_stub(&self) -> bool
Returns true if this is a Git stub.
Sourcepub fn versioned_kind(&self) -> Option<VersionedApiSpecKind>
pub fn versioned_kind(&self) -> Option<VersionedApiSpecKind>
For versioned APIs, returns the kind of storage.
Sourcepub fn to_json_filename(&self) -> ApiSpecFileName
pub fn to_json_filename(&self) -> ApiSpecFileName
Converts a Git stubname to its JSON equivalent.
For non-Git stubs, returns a clone of self.
Sourcepub fn to_git_stub_filename(&self) -> ApiSpecFileName
pub fn to_git_stub_filename(&self) -> ApiSpecFileName
Converts a JSON filename to its Git stub equivalent.
For Git stubs, returns a clone of self. For lockstep files, returns a clone of self (lockstep files are not converted to Git stubs).
Sourcepub fn git_stub_basename(&self) -> String
pub fn git_stub_basename(&self) -> String
Returns the basename for this file as a Git stub.
- If this is already a Git stub, returns
basename()directly. - If this is a versioned JSON file, returns
basename() + ".gitstub". - For lockstep, returns
basename()(lockstep files are not converted to Git stubs).
Sourcepub fn json_basename(&self) -> String
pub fn json_basename(&self) -> String
Returns the basename for this file as a JSON file.
- If this is a Git stub, returns the basename without the
.gitstubsuffix. - Otherwise, returns
basename()directly.
Sourcepub fn as_versioned(&self) -> Option<&VersionedApiSpecFileName>
pub fn as_versioned(&self) -> Option<&VersionedApiSpecFileName>
Returns a reference to the inner VersionedApiSpecFileName if this is
a versioned API, or None if this is a lockstep API.
Sourcepub fn into_versioned(self) -> Option<VersionedApiSpecFileName>
pub fn into_versioned(self) -> Option<VersionedApiSpecFileName>
Consumes self and returns the inner VersionedApiSpecFileName if
this is a versioned API, or None if this is a lockstep API.
Sourcepub fn as_lockstep(&self) -> Option<&LockstepApiSpecFileName>
pub fn as_lockstep(&self) -> Option<&LockstepApiSpecFileName>
Returns a reference to the inner LockstepApiSpecFileName if this is
a lockstep API, or None if this is a versioned API.
Sourcepub fn into_lockstep(self) -> Option<LockstepApiSpecFileName>
pub fn into_lockstep(self) -> Option<LockstepApiSpecFileName>
Consumes self and returns the inner LockstepApiSpecFileName if
this is a lockstep API, or None if this is a versioned API.
Trait Implementations§
Source§impl Clone for ApiSpecFileName
impl Clone for ApiSpecFileName
Source§fn clone(&self) -> ApiSpecFileName
fn clone(&self) -> ApiSpecFileName
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 ApiSpecFileName
impl Debug for ApiSpecFileName
Source§impl Display for ApiSpecFileName
impl Display for ApiSpecFileName
Source§impl From<LockstepApiSpecFileName> for ApiSpecFileName
impl From<LockstepApiSpecFileName> for ApiSpecFileName
Source§fn from(l: LockstepApiSpecFileName) -> Self
fn from(l: LockstepApiSpecFileName) -> Self
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 ApiSpecFileName
impl Ord for ApiSpecFileName
Source§fn cmp(&self, other: &ApiSpecFileName) -> Ordering
fn cmp(&self, other: &ApiSpecFileName) -> 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 ApiSpecFileName
impl PartialEq for ApiSpecFileName
Source§fn eq(&self, other: &ApiSpecFileName) -> bool
fn eq(&self, other: &ApiSpecFileName) -> bool
self and other values to be equal, and is used by ==.