Skip to main content

default_versions

Function default_versions 

Source
pub fn default_versions() -> Result<SupportedVersions, SupportedVersionsError>
Expand description

The revisions a client offers when the caller expresses no preference.

Every revision this build has wire types for. Narrowing is the caller’s call — a client pinned to one revision is useful, and so is one that will speak whatever the server prefers — but the default should not silently be a subset, because a client that offers less than it can speak is a client that gets refused by servers it would have worked with.

§Errors

SupportedVersionsError only if this build’s own table were empty, which SupportedVersions::all documents cannot happen. Returned rather than unwrapped because a function that cannot fail should say so in its type, and because inventing a one-revision fallback here would silently narrow a client on a build whose table is broken — which is the exact failure the default exists to prevent.