MCPcopy Create free account
hub / github.com/archlinux/alpm / try_from

Method try_from

alpm-srcinfo/src/schema.rs:164–169  ·  view source on GitHub ↗

Converts a [`SchemaVersion`] to a [`SourceInfoSchema`]. # Errors Returns an error if the [`SchemaVersion`]'s inner [`Version`] does not provide a major version that corresponds to a [`SourceInfoSchema`] variant.

(value: SchemaVersion)

Source from the content-addressed store, hash-verified

162 /// Returns an error if the [`SchemaVersion`]'s inner [`Version`] does not provide a major
163 /// version that corresponds to a [`SourceInfoSchema`] variant.
164 fn try_from(value: SchemaVersion) -> Result<Self, Self::Error> {
165 match value.inner().major {
166 1 => Ok(SourceInfoSchema::V1(value)),
167 _ => Err(Error::UnsupportedSchemaVersion(value.to_string())),
168 }
169 }
170}
171
172impl Display for SourceInfoSchema {

Callers

nothing calls this directly

Calls 1

innerMethod · 0.45

Tested by

no test coverage detected