pub trait Sign {
type Signature: Display;
Show 16 methods
// Required methods
fn get_signature_method_name(&self) -> &'static str;
fn request_method(&mut self, method: &str);
fn uri<T: Display>(&mut self, uri: T);
fn parameter<V: Display>(&mut self, key: &str, value: V);
fn delimiter(&mut self);
fn end(self) -> Self::Signature;
// Provided methods
fn callback<V: Display>(&mut self, value: V) { ... }
fn consumer_key<V: Display>(&mut self, value: V) { ... }
fn nonce<V: Display>(&mut self, value: V) { ... }
fn use_nonce(&self) -> bool { ... }
fn signature_method(&mut self) { ... }
fn timestamp(&mut self, value: u64) { ... }
fn use_timestamp(&self) -> bool { ... }
fn token<V: Display>(&mut self, value: V) { ... }
fn verifier<V: Display>(&mut self, value: V) { ... }
fn version(&mut self) { ... }
}Expand description
Algorithms to sign a signature base string (RFC 5849 section 3.4.1.).
The type will be incrementally passed a signature base string by a Serializer. For example,
a signature base string like the following (line breaks are for display purposes only):
POST&
http%3A%2F%2Fexample.com%2Frequest&
a%3Dr%2520b
%26
a2%3Da
%26
oauth_consumer_key%3D9djdj82h48djs9d2
%26
oauth_nonce%3D7d8f3e4a
%26
oauth_signature_method%3DHMAC-SHA1
%26
oauth_timestamp%3D137131201
%26
oauth_token%3Dkkk9d7dh3k39sjv7
%26
z%3D…is represented by a series of method calls like the following (sign is the Sign object):
sign.request_method("POST");
sign.uri("http%3A%2F%2Fexample.com%2Frequest");
sign.parameter("a", "r%2520b");
sign.delimiter();
sign.parameter("a2", "a");
sign.delimiter();
sign.consumer_key("9djdj82h48djs9d2");
sign.delimiter();
sign.nonce("7d8f3e4a");
sign.delimiter();
sign.signature_method();
sign.delimiter();
sign.timestamp(137131201);
sign.delimiter();
sign.token("kkk9d7dh3k39sjv7");
sign.delimiter();
sign.parameter("z", "");
let _ = sign.end();Required Associated Types§
Required Methods§
Sourcefn get_signature_method_name(&self) -> &'static str
fn get_signature_method_name(&self) -> &'static str
Returns the oauth_signature_method string for the signature method associated with the
algorithm.
Sourcefn request_method(&mut self, method: &str)
fn request_method(&mut self, method: &str)
Feeds self with the HTTP request method part of the signature base string.
Sourcefn uri<T: Display>(&mut self, uri: T)
fn uri<T: Display>(&mut self, uri: T)
Feeds self with the base string URI part of the signature base string.
Provided Methods§
Sourcefn callback<V: Display>(&mut self, value: V)
fn callback<V: Display>(&mut self, value: V)
Feeds self with the oauth_callback parameter part of the signature base string.
The default implementation forwards to the parameter method with "oauth_callback" as the first argument.
Sourcefn consumer_key<V: Display>(&mut self, value: V)
fn consumer_key<V: Display>(&mut self, value: V)
Feeds self with the oauth_consumer_key parameter part of the signature base string.
The default implementation forwards to the parameter method with "oauth_consumer_key" as the first argument.
Sourcefn nonce<V: Display>(&mut self, value: V)
fn nonce<V: Display>(&mut self, value: V)
Feeds self with the oauth_nonce parameter part of the signature base string.
The default implementation forwards to the parameter method with "oauth_nonce" as the first argument.
Sourcefn use_nonce(&self) -> bool
fn use_nonce(&self) -> bool
Whether the signature method uses the oauth_nonce parameter.
If this method returns false, Serializer implementations should not emit the
oauth_nonce part of the signature base string.
The default implementation returns true.
Sourcefn signature_method(&mut self)
fn signature_method(&mut self)
Feeds self with the oauth_signature_method parameter part of the
signature base string.
The default implementation forwards to the parameter method with
"oauth_signature_method" and self.get_signature_method_name() as the arguments.
Sourcefn timestamp(&mut self, value: u64)
fn timestamp(&mut self, value: u64)
Feeds self with the oauth_timestamp parameter part of the
signature base string.
The default implementation forwards to the parameter method with
"oauth_timestamp" as the first argument.
Sourcefn use_timestamp(&self) -> bool
fn use_timestamp(&self) -> bool
Whether the signature method uses the oauth_nonce parameter.
If this method returns false, Serializer implementations should not emit the
oauth_nonce part of the signature base string.
The default implementation returns true.
Sourcefn token<V: Display>(&mut self, value: V)
fn token<V: Display>(&mut self, value: V)
Feeds self with the oauth_token parameter part of the signature base string.
The default implementation forwards to the parameter method with "oauth_token" as the first argument.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.