pub struct Link {
pub api: String,
pub id: String,
pub secret: String,
}Expand description
An invite link taken apart into the three things redeeming one needs.
Fields§
§api: StringThe node’s API base: scheme and authority, no path, no trailing
slash. The same string every other command takes as <api>.
id: StringThe invite’s id, which is the user half of the credential that redeems it.
secret: StringThe invite’s secret, which is the password half.
Implementations§
Source§impl Link
impl Link
Sourcepub fn looks_like(argument: &str) -> bool
pub fn looks_like(argument: &str) -> bool
Whether a string is worth handing to Link::parse.
Used by the argument matcher to tell choir join <link> from
choir join <api> <invite-file> <key-file>, whose first argument
is also a URL. Only the path decides, so a mistyped link still
reaches parse and gets parse’s message rather than being
silently read as the three-argument form with two arguments
missing.
Sourcepub fn parse(link: &str) -> Result<Link, String>
pub fn parse(link: &str) -> Result<Link, String>
Recovers the node and the invite from the link the operator sent.
Hand-written rather than pulled from a URL crate: the grammar is one path and two query parameters, both of which the node mints itself, and this workspace adds dependencies reluctantly.
§Errors
Returns the sentence to print when the string is not an invite
link: no scheme, a scheme with no API base behind it, no /join
path, or either query parameter missing or empty. Every one of
them ends with the next: line a reader can act on.