monty-types 1.4.0

A secure, snapshotable Python sandbox written in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Projection of typed argument structs into the [`CallArgs`] host callbacks consume.
//! The `#[derive(ToArgs)]` macro in `monty-macros` emits implementations via
//! `crate::args::ToArgs`, which resolves in this crate.

use crate::object::CallArgs;

/// Projects a typed args struct into the [`CallArgs`] host callbacks expect.
/// Consumes `self` to avoid cloning owned fields.
///
/// Inverse of `monty`'s internal `FromArgs` (`ArgValues` → struct); driven by
/// [`crate::os::OsFunctionCall::to_args`] for the Python and JavaScript bindings.
pub trait ToArgs {
    /// Consumes the fields into arguments for delivery to the host.
    fn to_args(self) -> CallArgs;
}