Skip to main content

DeRecProtocolConfig

Struct DeRecProtocolConfig 

Source
pub struct DeRecProtocolConfig {
Show 13 fields pub threshold: Option<usize>, pub max_subshares: Option<u64>, pub timeouts: Option<TimeoutsConfig>, pub parameter_range: Option<ParameterRange>, pub auto_accept: Option<AutoAcceptPolicy>, pub auto_respond_on_failure: Option<bool>, pub auto_reply_to: Option<bool>, pub unpair_ack: Option<UnpairAck>, pub unsafe_connection: Option<bool>, pub communication_info: Option<HashMap<String, String>>, pub own_transports: Option<Vec<TransportProtocol>>, pub replica_id: Option<u64>, pub min_protocol_version: Option<ProtocolVersion>,
}
Expand description

Every data setting of a DeRecProtocolBuilder, each one optional, applied in one call by with_config.

A field left None is not applied: the builder keeps what it already holds. A field that is set is applied through the matching with_* setter and validated by build under exactly the rules that setter documents. Stores, the delivery transport and the secret_id are not settings and are not carried here.

Configs layer: apply a general config, then a per-user one, then any individual setter, and the last write wins per field. See with_config.

§Canonical JSON

With the serde feature the struct serializes to, and deserializes from, one JSON shape — the format for config files and user records, and the one every SDK accepts:

{
  "threshold": 3,
  "max_subshares": "12",
  "timeouts": {
    "inbound_message_secs": 300,
    "sharing_round_secs": 60,
    "unpair_ack_secs": 60,
    "get_share_response_secs": 300,
    "pairing_secs": 30,
    "expired_channels": { "enabled": true, "timeout_in_secs": 300 }
  },
  "parameter_range": { "min_share_size": 1, "max_share_size": 4096 },
  "auto_accept": { "pairing": true, "store_share": true },
  "auto_respond_on_failure": false,
  "auto_reply_to": false,
  "unpair_ack": "required",
  "unsafe_connection": false,
  "communication_info": { "name": "alice" },
  "own_transports": [{ "uri": "https://me.example.com/derec", "protocol": "https" }],
  "replica_id": "9007199254740993",
  "min_protocol_version": { "major": 0, "minor": 1 }
}
  • Keys are snake_case, and every key is optional: an absent key or a null value leaves that setting unset.
  • Unknown keys are rejected, at every level, so a misspelled key fails to parse instead of being ignored.
  • replica_id and max_subshares are u64 values written as decimal strings, which survive JSON encoders whose numbers are f64.
  • threshold is a JSON number.
  • timeouts carries whole seconds; see TimeoutsConfig.
  • parameter_range mirrors derec_proto::ParameterRange with snake_case names. Each bound is a JSON number or a decimal string, and an absent bound is 0 (“no bound”).
  • auto_accept has one boolean per flow, named as on AutoAcceptPolicy; an absent flow is false.
  • unpair_ack is "required" or "not_required", or the discriminant 0 or 1.
  • Each own_transports entry is {uri, protocol}, where protocol is "https" or "grpc" (any case) or its discriminant 0 or 1.
  • min_protocol_version is {major, minor}, both JSON numbers.

Serializing writes only the fields that are set, names rather than discriminants, and every flow of auto_accept and every bound of parameter_range.

Fields§

§threshold: Option<usize>§max_subshares: Option<u64>§timeouts: Option<TimeoutsConfig>

See with_timeouts. Merged per field; see TimeoutsConfig.

§parameter_range: Option<ParameterRange>§auto_accept: Option<AutoAcceptPolicy>§auto_respond_on_failure: Option<bool>§auto_reply_to: Option<bool>§unpair_ack: Option<UnpairAck>§unsafe_connection: Option<bool>§communication_info: Option<HashMap<String, String>>§own_transports: Option<Vec<TransportProtocol>>

See with_own_transports. An unknown protocol discriminant is rejected when the endpoint is parsed; structural checks (URI length, control characters, scheme) run later, at build().

§replica_id: Option<u64>§min_protocol_version: Option<ProtocolVersion>

Trait Implementations§

Source§

impl Clone for DeRecProtocolConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeRecProtocolConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DeRecProtocolConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DeRecProtocolConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DeRecProtocolConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DeRecProtocolConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DeRecProtocolConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V