Skip to main content

Agent

Struct Agent 

Source
pub struct Agent {
    pub schema: Schema,
    pub config: Option<Config>,
    /* private fields */
}
Expand description

§Thread Safety

Agent is not internally synchronized by design. All mutable fields (value, id, version, keys, etc.) are unprotected because every production entry point wraps Agent in an external Mutex:

  • SimpleAgent (simple/core.rs): agent: Mutex<Agent>
  • AgentWrapper (binding-core): inner: Arc<Mutex<Agent>>
  • FilesystemDocumentService: Arc<Mutex<Agent>>
  • JacsMcpServer: Arc<AgentWrapper> (which holds Arc<Mutex<Agent>>)

Adding field-level synchronization (e.g., Arc<Mutex<Value>> on each field) would double-lock with the external Mutex, adding overhead without benefit. The one exception is document_schemas which uses Arc<Mutex<>> because it was designed for independent schema loading that can outlive a single lock scope.

If you use Agent directly (without SimpleAgent or AgentWrapper), you must provide your own synchronization.

Fields§

§schema: Schema

the JSONSchema used todo use getter

§config: Option<Config>

use getter

Implementations§

Source§

impl Agent

Source

pub fn new( agentversion: &str, headerversion: &str, signature_version: &str, ) -> Result<Self, JacsError>

Source

pub fn from_config( config: Config, password: Option<&str>, ) -> Result<Self, JacsError>

Create and load an agent from a pre-built Config and optional password.

This is the canonical one-call agent loading API. Callers compose their own config (via Config::from_file() + optional apply_env_overrides()) and pass the password directly – no env var side-channels needed.

§Arguments
  • config - A pre-built Config (not re-read from file)
  • password - Optional private key password. If None, falls back to JACS_PRIVATE_KEY_PASSWORD env var inside keystore operations.
§Example
let mut config = Config::from_file("jacs.config.json")?;
config.apply_env_overrides();
let agent = Agent::from_config(config, Some("my-password"))?;
Source

pub fn ephemeral(algorithm: &str) -> Result<Self, JacsError>

Create an ephemeral agent with in-memory keys and storage. No config file, no directories, no environment variables needed.

Source

pub fn is_ephemeral(&self) -> bool

Returns true if this is an ephemeral (in-memory) agent.

Source

pub fn get_key_store(&self) -> Option<&dyn KeyStore>

Get a reference to the agent’s key store, if any.

Source

pub fn key_paths(&self) -> Option<&KeyPaths>

Get the agent’s resolved key paths, if any.

Source

pub fn set_key_paths(&mut self, paths: KeyPaths)

Set the agent’s key paths explicitly.

Source

pub fn password(&self) -> Option<&str>

Get the agent-scoped password, if set.

Source

pub fn set_password(&mut self, password: Option<String>)

Set the agent-scoped password.

Source

pub fn resolve_password(&self) -> Result<String, JacsError>

Resolve the private key password using the agent-scoped password if available, falling back to env/jenv/keychain.

Source

pub fn build_fs_store(&self) -> Result<FsEncryptedStore, JacsError>

Build an FsEncryptedStore from the agent’s key_paths and password.

Source

pub fn set_dns_strict(&mut self, strict: bool)

Source

pub fn set_dns_validate(&mut self, enabled: bool)

Source

pub fn set_dns_required(&mut self, required: bool)

Source

pub fn load_by_id(&mut self, lookup_id: String) -> Result<(), JacsError>

Source

pub fn load_by_config(&mut self, path: String) -> Result<(), JacsError>

Source

pub fn load_by_config_file_only( &mut self, path: String, ) -> Result<(), JacsError>

Load agent configuration from a file without applying env/jenv overrides.

This is the isolation-safe counterpart of load_by_config. It reads configuration exclusively from the specified file, ignoring any ambient JACS_* environment variables or jenv overrides. This eliminates the need for save/clear/restore guard patterns around the load call (Issue 008).

Source

pub fn set_storage(&mut self, storage: MultiStorage)

let storage = MultiStorage::new(“memory”.to_string())?; agent.set_storage(storage);

Source

pub fn storage_ref(&self) -> &MultiStorage

Returns a reference to the agent’s internal storage backend.

This is primarily used by service_from_agent to reuse the correctly-rooted MultiStorage that load_by_config set up, rather than creating a new one with a potentially-relative base directory.

Source

pub fn set_storage_root(&mut self, root: PathBuf) -> Result<(), JacsError>

Replace the internal storage with one rooted at root.

This is used by verify_document_standalone so that absolute data/key directory paths work regardless of the current working directory. MultiStorage::clean_path strips leading slashes, turning absolute paths into paths relative to the FS store root. By rooting at / the resolved path is still correct.

Source

pub fn ready(&self) -> bool

Returns true if the agent is fully initialized and ready for signing/verification.

Checks that all required state is present: ID, version, keys, config, and value.

Source

pub fn get_value(&self) -> Option<&Value>

Get the agent’s JSON value

Source

pub fn get_key_algorithm(&self) -> Option<&String>

Get the agent’s key algorithm

Source

pub fn set_keys( &mut self, private_key: Vec<u8>, public_key: Vec<u8>, key_algorithm: &str, ) -> Result<(), JacsError>

Source

pub fn set_keys_raw( &mut self, private_key: Vec<u8>, public_key: Vec<u8>, key_algorithm: &str, )

Store keys without AES encryption. For ephemeral agents only. The raw private key bytes are wrapped in SecretBox directly.

Source

pub fn get_private_key(&self) -> Result<&SecretPrivateKey, JacsError>

Source

pub fn load(&mut self, agent_string: &str) -> Result<(), JacsError>

Source

pub fn verify_self_signature(&mut self) -> Result<(), JacsError>

Source

pub fn get_agent_for_doc( &mut self, document_key: String, signature_key_from: Option<&str>, ) -> Result<String, JacsError>

Source

pub fn signature_verification_procedure( &self, json_value: &Value, fields: Option<&[String]>, signature_key_from: &str, public_key: Vec<u8>, public_key_enc_type: Option<String>, original_public_key_hash: Option<String>, signature: Option<String>, ) -> Result<(), JacsError>

Source

pub fn signing_procedure( &mut self, json_value: &Value, fields: Option<&[String]>, placement_key: &str, ) -> Result<Value, JacsError>

Generates a signature JSON fragment for the specified JSON value.

This function takes a JSON value, an optional list of fields to include in the signature, and a placement key. It retrieves the values of the specified fields from the JSON value, signs them using the agent’s signing key, and returns a new JSON value containing the signature and related metadata.

If no fields are provided, the function will choose system default fields. Note that if the system default fields change, it could cause problems with signature verification.

§Arguments
  • json_value - A reference to the JSON value to be signed.
  • fields - An optional reference to a vector of field names to include in the signature. If None, system default fields will be used.
  • placement_key - A reference to a string representing the key where the signature should be placed in the resulting JSON value.
§Returns
  • Ok(Value) - A new JSON value containing the signature and related metadata.
  • Err(JacsError) - An error occurred while generating the signature.
§Errors

This function may return an error in the following cases:

  • If the specified fields are not found in the JSON value.
  • If an error occurs while signing the values.
  • If an error occurs while serializing the accepted fields.
  • If an error occurs while retrieving the agent’s public key.
  • If an error occurs while validating the generated signature against the schema.
Source

pub fn verify_hash(&self, doc: &Value) -> Result<bool, JacsError>

verify the hash of a complete document that has SHA256_FIELDNAME

Source

pub fn verify_self_hash(&self) -> Result<bool, JacsError>

verify the hash where the document is the agent itself.

Source

pub fn get_schema_keys(&mut self) -> Vec<String>

Source

pub fn update_self( &mut self, new_agent_string: &str, ) -> Result<String, JacsError>

pass in modified agent’s JSON the function will replace it’s internal value after: versioning resigning rehashing

Source

pub fn rotate_self( &mut self, algorithm_override: Option<&str>, ) -> Result<(String, Vec<u8>, Value), JacsError>

Rotates the agent’s keys and creates a new version of the agent document.

Unlike update_self which re-signs with the existing key, this method:

  1. Archives old keys (filesystem) or discards them (ephemeral)
  2. Generates a new keypair
  3. Creates a new agent version
  4. Signs the new document with the new key
  5. Produces a jacsKeyRotationProof signed with the old key
§Arguments
  • algorithm_override - If Some, use this algorithm for the new keys instead of reading from config. The config’s jacs_agent_key_algorithm is also updated in memory.

Returns (new_version, new_public_key_bytes, signed_agent_json).

Source

pub fn verify_transition_proof( proof: &Value, old_public_key_bytes: &[u8], ) -> Result<(), JacsError>

Verify a jacsKeyRotationProof using the old public key.

The proof contains a transitionMessage signed with the old key. This function re-derives the expected message from the proof’s metadata and checks the cryptographic signature against old_public_key_bytes.

Returns Ok(()) if the proof is valid, or Err if verification fails.

Source

pub fn validate_header(&mut self, json: &str) -> Result<Value, JacsError>

Source

pub fn validate_agent(&mut self, json: &str) -> Result<Value, JacsError>

Source

pub fn load_custom_schemas( &mut self, schema_paths: &[String], ) -> Result<(), String>

Source

pub fn save(&self) -> Result<String, JacsError>

Source

pub fn create_agent_and_load( &mut self, json: &str, create_keys: bool, _create_keys_algorithm: Option<&str>, ) -> Result<Value, JacsError>

create an agent, and provde id and version as a result

Source

pub fn sign_config(&mut self, config_json: &Value) -> Result<Value, JacsError>

Sign a config JSON value, producing a JACS document with header fields.

Uses Schema::create for initial ID/version assignment. The resulting JSON has jacsType: "config", jacsLevel: "config", a jacsSignature, and jacsSha256.

Source

pub fn verify_config(&mut self, config_json: &Value) -> Result<(), JacsError>

Verify a previously signed config document: schema + hash + signature.

This mirrors the same checks that SimpleAgent::verify() performs:

  1. validate_header — schema validation + verify_hash
  2. signature_verification_procedure — cryptographic signature check
Source

pub fn update_config(&mut self, config_json: &Value) -> Result<Value, JacsError>

Update and re-sign an existing signed config document.

Bumps jacsVersion, sets jacsPreviousVersion, re-signs and re-hashes. jacsId is preserved.

Source

pub fn builder() -> AgentBuilder

Returns an AgentBuilder for constructing an Agent with a fluent API.

§Example
use jacs::agent::Agent;

// Build an agent with default v1 versions
let agent = Agent::builder().build()?;

// Build an agent with custom configuration
let agent = Agent::builder()
    .config_path("path/to/jacs.config.json")
    .dns_strict(true)
    .build()?;

// Build an agent with explicit versions
let agent = Agent::builder()
    .agent_version("v1")
    .header_version("v1")
    .signature_version("v1")
    .build()?;
Source

pub fn verify_batch( &self, items: &[(String, String, Vec<u8>, Option<String>)], ) -> Vec<Result<(), JacsError>>

Verifies multiple signatures in a batch operation.

This method processes each verification sequentially. For CPU-bound signature verification, this is often efficient due to the cryptographic operations being compute-intensive. If parallel verification is needed, consider using rayon’s par_iter() on the input slice externally.

§Arguments
  • items - A slice of tuples containing:
    • data: The string data that was signed
    • signature: The base64-encoded signature
    • public_key: The public key bytes for verification
    • algorithm: Optional algorithm hint (e.g., “ring-Ed25519”, “RSA-PSS”)
§Returns

A vector of Result<(), JacsError> in the same order as the input items.

  • Ok(()) indicates the signature is valid
  • Err(JacsError) indicates verification failed with a specific reason
§Example
use jacs::agent::Agent;

let agent = Agent::builder().build()?;

let items = vec![
    ("message1".to_string(), sig1, pk1.clone(), None),
    ("message2".to_string(), sig2, pk2.clone(), Some("ring-Ed25519".to_string())),
];

let results = agent.verify_batch(&items);
for (i, result) in results.iter().enumerate() {
    match result {
        Ok(()) => println!("Item {} verified successfully", i),
        Err(e) => println!("Item {} failed: {}", i, e),
    }
}
§Performance Notes
  • Verification is sequential; for parallel verification, use rayon externally
  • Each verification is independent and does not short-circuit on failure
  • The method returns all results even if some verifications fail
Source§

impl Agent

Source

pub fn sign_bytes(&mut self, data: &[u8]) -> Result<Vec<u8>, JacsError>

Sign raw bytes and return the base64-encoded signature.

This is the byte-level equivalent of sign_string. Used by the email signing module where the payload is binary.

Source

pub fn generate_keys_with_store( &mut self, ks: &dyn KeyStore, ) -> Result<(), JacsError>

Generate keys using a specific KeyStore implementation. For ephemeral agents, uses set_keys_raw (no AES encryption). For persistent agents, uses set_keys (AES-encrypts private key).

Trait Implementations§

Source§

impl Agreement for Agent

Source§

fn remove_agents_from_agreement( &mut self, document_key: &str, agentids: &[String], agreement_fieldname: Option<String>, ) -> Result<JACSDocument, JacsError>

TODO also remove their signature

Source§

fn agreement_get_question_and_context( &self, document_key: &str, agreement_fieldname: Option<String>, ) -> Result<(String, String), JacsError>

get human readable fields

Source§

fn check_agreement( &self, document_key: &str, agreement_fieldname: Option<String>, ) -> Result<String, JacsError>

checking agreements requires you have the public key of each signatory if the document hashes don’t match or there are unsigned, it will fail

Enforces optional agreement constraints:

  • timeout: if set and expired, returns an error
  • quorum: if set, only quorum signatures are required (M-of-N)
  • requiredAlgorithms: if set, rejects signatures not using a listed algorithm
  • minimumStrength: if set, rejects signatures below the strength tier
Source§

fn agreement_hash( &self, value: Value, agreement_fieldname: &str, ) -> Result<String, JacsError>

agreements update documents however this updates the document, which updates, version, lastversion and version date the agreement itself needs it’s own hash to track on a subset of fields the standard hash detects any changes at all
Source§

fn trim_fields_for_hashing_and_signing( &self, value: Value, agreement_fieldname: &str, ) -> Result<(String, Vec<String>), JacsError>

remove fields that should not be used for agreement signature
Source§

fn create_agreement( &mut self, document_key: &str, agentids: &[String], question: Option<&str>, context: Option<&str>, agreement_fieldname: Option<String>, ) -> Result<JACSDocument, JacsError>

given a document id and a list of agents, return an updated document with an agreement field fails if an agreement field exists no other fields can be modified or the agreement fails overwrites previous agreements
Source§

fn create_agreement_with_options( &mut self, document_key: &str, agentids: &[String], question: Option<&str>, context: Option<&str>, agreement_fieldname: Option<String>, options: &AgreementOptions, ) -> Result<JACSDocument, JacsError>

Create an agreement with extended options (timeout, quorum, algorithm constraints).
Source§

fn add_agents_to_agreement( &mut self, document_key: &str, agentids: &[String], agreement_fieldname: Option<String>, ) -> Result<JACSDocument, JacsError>

given a document id and a list of agents, return an updated document
Source§

fn sign_agreement( &mut self, document_key: &str, agreement_fieldname: Option<String>, ) -> Result<JACSDocument, JacsError>

given a document id sign a document, return an updated document
Source§

impl BoilerPlate for Agent

Source§

impl Debug for Agent

Source§

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

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

impl Display for Agent

Source§

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

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

impl DocumentTraits for Agent

Source§

fn create_document_and_load( &mut self, json: &str, attachments: Option<Vec<String>>, embed: Option<bool>, ) -> Result<JACSDocument, JacsError>

create an document, and provde id and version as a result filepaths:

Source§

fn update_document( &mut self, document_key: &str, new_document_string: &str, attachments: Option<Vec<String>>, embed: Option<bool>, ) -> Result<JACSDocument, JacsError>

pass in modified doc the original document needs to be marked as obsolete but this means not a deletion, but a move of the file

Source§

fn copy_document( &mut self, document_key: &str, ) -> Result<JACSDocument, JacsError>

copys document without modifications

Source§

fn diff_json_strings( &self, json1: &str, json2: &str, ) -> Result<(String, String), JacsError>

Function to diff two JSON strings and print the differences.

Source§

fn validate_document_with_custom_schema( &self, schema_path: &str, json: &Value, ) -> Result<(), String>

Source§

fn create_file_json( &mut self, filepath: &str, embed: bool, ) -> Result<Value, JacsError>

Source§

fn verify_document_files(&mut self, document: &Value) -> Result<(), JacsError>

Source§

fn load_document( &mut self, document_string: &str, ) -> Result<JACSDocument, JacsError>

Source§

fn load_all( &mut self, store: bool, load_only_recent: bool, ) -> Result<Vec<JACSDocument>, Vec<JacsError>>

Source§

fn hash_doc(&self, doc: &Value) -> Result<String, JacsError>

Source§

fn store_jacs_document( &mut self, value: &Value, ) -> Result<JACSDocument, JacsError>

Source§

fn get_document(&self, document_key: &str) -> Result<JACSDocument, JacsError>

Source§

fn remove_document( &mut self, document_key: &str, ) -> Result<JACSDocument, JacsError>

Source§

fn get_document_keys(&mut self) -> Vec<String>

Source§

fn archive_old_version( &mut self, original_document: &JACSDocument, ) -> Result<(), JacsError>

Source§

fn save_document( &mut self, document_key: &str, output_filename: Option<String>, export_embedded: Option<bool>, extract_only: Option<bool>, ) -> Result<(), JacsError>

export_embedded if there is embedded files recreate them, default false
Source§

fn verify_external_document_signature( &mut self, document_key: &str, ) -> Result<(), JacsError>

Source§

fn get_document_signature_agent_id( &mut self, document_key: &str, ) -> Result<String, JacsError>

Source§

fn get_document_signature_date( &mut self, document_key: &str, ) -> Result<String, JacsError>

Source§

fn verify_document_signature( &mut self, document_key: &str, signature_key_from: Option<&str>, fields: Option<&[String]>, public_key: Option<Vec<u8>>, public_key_enc_type: Option<String>, ) -> Result<(), JacsError>

Source§

fn parse_attachement_arg( &mut self, attachments: Option<&str>, ) -> Option<Vec<String>>

util function for parsing arguments for attachments
Source§

fn diff_strings( &self, string_one: &str, string_two: &str, ) -> (String, String, String)

Source§

fn create_documents_batch( &mut self, documents: &[&str], ) -> Result<Vec<JACSDocument>, JacsError>

Creates and signs multiple documents in a batch operation. Read more
Source§

impl FileLoader for Agent

Available on non-WebAssembly only.
Source§

fn fs_load_public_key(&self, hash: &str) -> Result<Vec<u8>, JacsError>

in JACS the public keys need to be added manually

Source§

fn fs_save_remote_public_key( &self, agent_id_and_version: &str, public_key: &[u8], public_key_enc_type: &[u8], ) -> Result<(), JacsError>

in JACS the public keys need to be added manually

Source§

fn fs_preload_keys( &mut self, private_key_filename: &str, public_key_filename: &str, custom_key_algorithm: Option<String>, ) -> Result<(), JacsError>

a way to load keys that aren’t default

Source§

fn fs_docs_load_all(&mut self) -> Result<Vec<String>, Vec<JacsError>>

function used to load all documents present

Source§

fn create_backup(&self, file_path: &str) -> Result<String, JacsError>

private Helper function to create a backup file name based on the current timestamp

Source§

fn use_filesystem(&self) -> bool

Source§

fn fs_save_keys(&mut self) -> Result<(), JacsError>

Source§

fn fs_load_keys(&mut self) -> Result<(), JacsError>

Source§

fn fs_load_public_key_type(&self, hash: &str) -> Result<String, JacsError>

Source§

fn fs_agent_load(&self, agentid: &str) -> Result<String, JacsError>

Source§

fn fs_agent_save( &self, agentid: &str, agent_string: &str, ) -> Result<String, JacsError>

Source§

fn fs_document_archive(&self, lookup_key: &str) -> Result<(), JacsError>

Source§

fn fs_document_save( &self, document_id: &str, document_string: &str, output_filename: Option<String>, ) -> Result<String, JacsError>

Source§

fn fs_get_document_content( &self, document_filepath: String, ) -> Result<String, JacsError>

used to get base64 content from a filepath
Source§

fn load_public_key_file(&self, filename: &str) -> Result<Vec<u8>, JacsError>

Source§

fn load_private_key(&self, filename: &str) -> Result<Vec<u8>, JacsError>

Source§

fn save_private_key( &self, full_filepath: &str, private_key: &[u8], ) -> Result<String, JacsError>

Source§

fn make_data_directory_path(&self, filename: &str) -> Result<String, JacsError>

Source§

fn make_key_directory_path(&self, filename: &str) -> Result<String, JacsError>

Source§

impl KeyManager for Agent

Source§

fn generate_keys(&mut self) -> Result<(), JacsError>

this necessatates updateding the version of the agent

Source§

fn sign_string(&mut self, data: &str) -> Result<String, JacsError>

Source§

fn sign_batch(&mut self, messages: &[&str]) -> Result<Vec<String>, JacsError>

Signs multiple strings in a batch operation. Read more
Source§

fn verify_string( &self, data: &str, signature_base64: &str, public_key: Vec<u8>, public_key_enc_type: Option<String>, ) -> Result<(), JacsError>

Source§

impl PayloadTraits for Agent

Source§

fn sign_payload(&mut self, jacs_payload: Value) -> Result<String, JacsError>

Source§

fn verify_payload( &mut self, document_string: String, max_replay_time_delta: Option<u64>, ) -> Result<Value, JacsError>

Source§

fn verify_payload_with_agent_id( &mut self, document_string: String, max_replay_time_delta_seconds: Option<u64>, ) -> Result<(Value, String), JacsError>

Source§

impl SecurityTraits for Agent

Source§

fn check_data_directory(&self) -> Result<(), JacsError>

this function attempts to detect executable files if they should be there alert the user /// it will move all exuctable documents in JACS_DATA_DIRECTORY a quarantine directory

Source§

fn use_security(&self) -> bool

determine if the system is configured ot use security features EXPERIMENTAL

Source§

fn use_fs_security(&self) -> bool

Source§

fn mark_file_not_executable(&self, path: &Path) -> Result<(), JacsError>

Source§

fn is_executable(&self, path: &Path) -> bool

Source§

fn quarantine_file(&self, file_path: &Path) -> Result<(), JacsError>

Auto Trait Implementations§

§

impl Freeze for Agent

§

impl !RefUnwindSafe for Agent

§

impl Send for Agent

§

impl Sync for Agent

§

impl Unpin for Agent

§

impl UnsafeUnpin for Agent

§

impl !UnwindSafe for Agent

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

Source§

impl<T> ValidateIp for T
where T: ToString,

Source§

fn validate_ipv4(&self) -> bool

Validates whether the given string is an IP V4
Source§

fn validate_ipv6(&self) -> bool

Validates whether the given string is an IP V6
Source§

fn validate_ip(&self) -> bool

Validates whether the given string is an IP
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more