pub enum ApiDocFileName {
Lockstep(LockstepApiDocFileName),
Versioned(VersionedApiDocFileName),
}Expand description
Describes the path to an OpenAPI document file, relative to some root where similar documents are found.
Variants§
Lockstep(LockstepApiDocFileName)
A lockstep API: single OpenAPI document, no versioning.
Versioned(VersionedApiDocFileName)
A versioned API: multiple versions can coexist.
Implementations§
Source§impl ApiDocFileName
impl ApiDocFileName
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<VersionedApiDocKind>
pub fn versioned_kind(&self) -> Option<VersionedApiDocKind>
For versioned APIs, returns the kind of storage.
Sourcepub fn to_json_filename(&self) -> ApiDocFileName
pub fn to_json_filename(&self) -> ApiDocFileName
Converts a Git stubname to its JSON equivalent.
For non-Git stubs, returns a clone of self.
Sourcepub fn to_git_stub_filename(&self) -> ApiDocFileName
pub fn to_git_stub_filename(&self) -> ApiDocFileName
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<&VersionedApiDocFileName>
pub fn as_versioned(&self) -> Option<&VersionedApiDocFileName>
Returns a reference to the inner VersionedApiDocFileName if this is
a versioned API, or None if this is a lockstep API.
Sourcepub fn into_versioned(self) -> Option<VersionedApiDocFileName>
pub fn into_versioned(self) -> Option<VersionedApiDocFileName>
Consumes self and returns the inner VersionedApiDocFileName if
this is a versioned API, or None if this is a lockstep API.
Sourcepub fn as_lockstep(&self) -> Option<&LockstepApiDocFileName>
pub fn as_lockstep(&self) -> Option<&LockstepApiDocFileName>
Returns a reference to the inner LockstepApiDocFileName if this is
a lockstep API, or None if this is a versioned API.
Sourcepub fn into_lockstep(self) -> Option<LockstepApiDocFileName>
pub fn into_lockstep(self) -> Option<LockstepApiDocFileName>
Consumes self and returns the inner LockstepApiDocFileName if
this is a lockstep API, or None if this is a versioned API.
Trait Implementations§
Source§impl Clone for ApiDocFileName
impl Clone for ApiDocFileName
Source§fn clone(&self) -> ApiDocFileName
fn clone(&self) -> ApiDocFileName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more