Skip to main content

EvaluatorManager

Struct EvaluatorManager 

Source
pub struct EvaluatorManager { /* private fields */ }
Expand description

Manages pkl server processes and evaluator instances.

Implementations§

Source§

impl EvaluatorManager

Source

pub fn new() -> Result<Self>

Create a new EvaluatorManager, starting a pkl server process.

Examples found in repository?
examples/basic.rs (line 11)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let mut manager = EvaluatorManager::new()?;
12    let opts = EvaluatorOptions::preconfigured();
13    let evaluator = manager.new_evaluator(opts)?;
14
15    // Evaluate inline Pkl text
16    let source = ModuleSource::text(
17        r#"
18        host = "localhost"
19        port = 8080
20        "#,
21    );
22
23    let server: Server = manager.evaluate_module_typed(&evaluator, source)?;
24    println!("Server: {server:?}");
25
26    // Evaluate a Pkl file (if it exists)
27    // let source = ModuleSource::file("config.pkl");
28    // let value = manager.evaluate_module(&evaluator, source)?;
29    // println!("Value: {value:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
More examples
Hide additional examples
examples/multiple_modules.rs (line 23)
22fn main() -> Result<(), Box<dyn std::error::Error>> {
23    let mut manager = EvaluatorManager::new()?;
24    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
25
26    // First module: database config
27    let db: DbConfig = manager.evaluate_module_typed(
28        &evaluator,
29        ModuleSource::text(
30            r#"
31            host = "db.internal"
32            port = 5432
33            name = "myapp_production"
34            "#,
35        ),
36    )?;
37    println!("Database: {db:?}");
38
39    // Second module: cache config
40    let cache: CacheConfig = manager.evaluate_module_typed(
41        &evaluator,
42        ModuleSource::text(
43            r#"
44            host = "redis.internal"
45            port = 6379
46            ttl = 3600
47            "#,
48        ),
49    )?;
50    println!("Cache: {cache:?}");
51
52    manager.close_evaluator(&evaluator)?;
53    Ok(())
54}
examples/typed_eval.rs (line 22)
21fn main() -> Result<(), Box<dyn std::error::Error>> {
22    let mut manager = EvaluatorManager::new()?;
23    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
24
25    let source = ModuleSource::text(
26        r#"
27        name = "my-service"
28        version = "2.1.0"
29        server {
30            host = "0.0.0.0"
31            port = 8443
32            maxConnections = 100
33        }
34        features = new Listing {
35            "auth"
36            "logging"
37            "metrics"
38        }
39        "#,
40    );
41
42    let config: AppConfig = manager.evaluate_module_typed(&evaluator, source)?;
43    println!("App: {} v{}", config.name, config.version);
44    println!("Server: {}:{}", config.server.host, config.server.port);
45    println!("Max connections: {}", config.server.max_connections);
46    println!("Features: {:?}", config.features);
47
48    manager.close_evaluator(&evaluator)?;
49    Ok(())
50}
examples/expressions.rs (line 5)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let mut manager = EvaluatorManager::new()?;
6    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
7
8    let source = ModuleSource::text(
9        r#"
10        name = "my-app"
11        port = 8080
12        url = "http://localhost:\(port)"
13        hosts = new Listing { "web-1"; "web-2"; "web-3" }
14        "#,
15    );
16
17    // Evaluate the whole module
18    let full = manager.evaluate_module(&evaluator, source.clone())?;
19    println!("Full module:\n{full:#?}\n");
20
21    // Evaluate a single expression
22    let name = manager.evaluate_expression(&evaluator, source.clone(), Some("name"))?;
23    println!("name = {name:?}");
24
25    let url = manager.evaluate_expression(&evaluator, source.clone(), Some("url"))?;
26    println!("url = {url:?}");
27
28    let hosts = manager.evaluate_expression(&evaluator, source, Some("hosts"))?;
29    println!("hosts = {hosts:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
examples/raw_values.rs (line 8)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let mut manager = EvaluatorManager::new()?;
9    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
10
11    let source = ModuleSource::text(
12        r#"
13        name = "example"
14        port = 8080
15        debug = true
16        tags = new Listing { "web"; "api" }
17        "#,
18    );
19
20    let value = manager.evaluate_module(&evaluator, source)?;
21
22    // Access properties via the convenience method
23    if let Some(props) = value.as_properties() {
24        for (key, val) in &props {
25            match val {
26                PklValue::String(s) => println!("{key} = \"{s}\""),
27                PklValue::Int(n) => println!("{key} = {n}"),
28                PklValue::Bool(b) => println!("{key} = {b}"),
29                PklValue::List(items) => {
30                    let strs: Vec<_> = items.iter().filter_map(|v| v.as_str()).collect();
31                    println!("{key} = {strs:?}");
32                }
33                other => println!("{key} = {other:?}"),
34            }
35        }
36    }
37
38    // Direct value accessors
39    let name = value
40        .as_properties()
41        .and_then(|p| p.get("name").copied())
42        .and_then(|v| v.as_str());
43    println!("\nDirect access — name: {name:?}");
44
45    manager.close_evaluator(&evaluator)?;
46    Ok(())
47}
Source

pub fn with_command(pkl_command: &str) -> Result<Self>

Create a new EvaluatorManager with a custom pkl command.

Source

pub fn new_evaluator(&mut self, opts: EvaluatorOptions) -> Result<Evaluator>

Create a new evaluator with the given options.

Examples found in repository?
examples/basic.rs (line 13)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let mut manager = EvaluatorManager::new()?;
12    let opts = EvaluatorOptions::preconfigured();
13    let evaluator = manager.new_evaluator(opts)?;
14
15    // Evaluate inline Pkl text
16    let source = ModuleSource::text(
17        r#"
18        host = "localhost"
19        port = 8080
20        "#,
21    );
22
23    let server: Server = manager.evaluate_module_typed(&evaluator, source)?;
24    println!("Server: {server:?}");
25
26    // Evaluate a Pkl file (if it exists)
27    // let source = ModuleSource::file("config.pkl");
28    // let value = manager.evaluate_module(&evaluator, source)?;
29    // println!("Value: {value:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
More examples
Hide additional examples
examples/multiple_modules.rs (line 24)
22fn main() -> Result<(), Box<dyn std::error::Error>> {
23    let mut manager = EvaluatorManager::new()?;
24    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
25
26    // First module: database config
27    let db: DbConfig = manager.evaluate_module_typed(
28        &evaluator,
29        ModuleSource::text(
30            r#"
31            host = "db.internal"
32            port = 5432
33            name = "myapp_production"
34            "#,
35        ),
36    )?;
37    println!("Database: {db:?}");
38
39    // Second module: cache config
40    let cache: CacheConfig = manager.evaluate_module_typed(
41        &evaluator,
42        ModuleSource::text(
43            r#"
44            host = "redis.internal"
45            port = 6379
46            ttl = 3600
47            "#,
48        ),
49    )?;
50    println!("Cache: {cache:?}");
51
52    manager.close_evaluator(&evaluator)?;
53    Ok(())
54}
examples/typed_eval.rs (line 23)
21fn main() -> Result<(), Box<dyn std::error::Error>> {
22    let mut manager = EvaluatorManager::new()?;
23    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
24
25    let source = ModuleSource::text(
26        r#"
27        name = "my-service"
28        version = "2.1.0"
29        server {
30            host = "0.0.0.0"
31            port = 8443
32            maxConnections = 100
33        }
34        features = new Listing {
35            "auth"
36            "logging"
37            "metrics"
38        }
39        "#,
40    );
41
42    let config: AppConfig = manager.evaluate_module_typed(&evaluator, source)?;
43    println!("App: {} v{}", config.name, config.version);
44    println!("Server: {}:{}", config.server.host, config.server.port);
45    println!("Max connections: {}", config.server.max_connections);
46    println!("Features: {:?}", config.features);
47
48    manager.close_evaluator(&evaluator)?;
49    Ok(())
50}
examples/expressions.rs (line 6)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let mut manager = EvaluatorManager::new()?;
6    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
7
8    let source = ModuleSource::text(
9        r#"
10        name = "my-app"
11        port = 8080
12        url = "http://localhost:\(port)"
13        hosts = new Listing { "web-1"; "web-2"; "web-3" }
14        "#,
15    );
16
17    // Evaluate the whole module
18    let full = manager.evaluate_module(&evaluator, source.clone())?;
19    println!("Full module:\n{full:#?}\n");
20
21    // Evaluate a single expression
22    let name = manager.evaluate_expression(&evaluator, source.clone(), Some("name"))?;
23    println!("name = {name:?}");
24
25    let url = manager.evaluate_expression(&evaluator, source.clone(), Some("url"))?;
26    println!("url = {url:?}");
27
28    let hosts = manager.evaluate_expression(&evaluator, source, Some("hosts"))?;
29    println!("hosts = {hosts:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
examples/raw_values.rs (line 9)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let mut manager = EvaluatorManager::new()?;
9    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
10
11    let source = ModuleSource::text(
12        r#"
13        name = "example"
14        port = 8080
15        debug = true
16        tags = new Listing { "web"; "api" }
17        "#,
18    );
19
20    let value = manager.evaluate_module(&evaluator, source)?;
21
22    // Access properties via the convenience method
23    if let Some(props) = value.as_properties() {
24        for (key, val) in &props {
25            match val {
26                PklValue::String(s) => println!("{key} = \"{s}\""),
27                PklValue::Int(n) => println!("{key} = {n}"),
28                PklValue::Bool(b) => println!("{key} = {b}"),
29                PklValue::List(items) => {
30                    let strs: Vec<_> = items.iter().filter_map(|v| v.as_str()).collect();
31                    println!("{key} = {strs:?}");
32                }
33                other => println!("{key} = {other:?}"),
34            }
35        }
36    }
37
38    // Direct value accessors
39    let name = value
40        .as_properties()
41        .and_then(|p| p.get("name").copied())
42        .and_then(|v| v.as_str());
43    println!("\nDirect access — name: {name:?}");
44
45    manager.close_evaluator(&evaluator)?;
46    Ok(())
47}
Source

pub fn evaluate_module( &mut self, evaluator: &Evaluator, source: ModuleSource, ) -> Result<PklValue>

Evaluate a module and return the raw PklValue.

Examples found in repository?
examples/expressions.rs (line 18)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let mut manager = EvaluatorManager::new()?;
6    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
7
8    let source = ModuleSource::text(
9        r#"
10        name = "my-app"
11        port = 8080
12        url = "http://localhost:\(port)"
13        hosts = new Listing { "web-1"; "web-2"; "web-3" }
14        "#,
15    );
16
17    // Evaluate the whole module
18    let full = manager.evaluate_module(&evaluator, source.clone())?;
19    println!("Full module:\n{full:#?}\n");
20
21    // Evaluate a single expression
22    let name = manager.evaluate_expression(&evaluator, source.clone(), Some("name"))?;
23    println!("name = {name:?}");
24
25    let url = manager.evaluate_expression(&evaluator, source.clone(), Some("url"))?;
26    println!("url = {url:?}");
27
28    let hosts = manager.evaluate_expression(&evaluator, source, Some("hosts"))?;
29    println!("hosts = {hosts:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
More examples
Hide additional examples
examples/raw_values.rs (line 20)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let mut manager = EvaluatorManager::new()?;
9    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
10
11    let source = ModuleSource::text(
12        r#"
13        name = "example"
14        port = 8080
15        debug = true
16        tags = new Listing { "web"; "api" }
17        "#,
18    );
19
20    let value = manager.evaluate_module(&evaluator, source)?;
21
22    // Access properties via the convenience method
23    if let Some(props) = value.as_properties() {
24        for (key, val) in &props {
25            match val {
26                PklValue::String(s) => println!("{key} = \"{s}\""),
27                PklValue::Int(n) => println!("{key} = {n}"),
28                PklValue::Bool(b) => println!("{key} = {b}"),
29                PklValue::List(items) => {
30                    let strs: Vec<_> = items.iter().filter_map(|v| v.as_str()).collect();
31                    println!("{key} = {strs:?}");
32                }
33                other => println!("{key} = {other:?}"),
34            }
35        }
36    }
37
38    // Direct value accessors
39    let name = value
40        .as_properties()
41        .and_then(|p| p.get("name").copied())
42        .and_then(|v| v.as_str());
43    println!("\nDirect access — name: {name:?}");
44
45    manager.close_evaluator(&evaluator)?;
46    Ok(())
47}
Source

pub fn evaluate_module_typed<T: DeserializeOwned>( &mut self, evaluator: &Evaluator, source: ModuleSource, ) -> Result<T>

Evaluate a module and deserialize the result into a Rust type.

Examples found in repository?
examples/basic.rs (line 23)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let mut manager = EvaluatorManager::new()?;
12    let opts = EvaluatorOptions::preconfigured();
13    let evaluator = manager.new_evaluator(opts)?;
14
15    // Evaluate inline Pkl text
16    let source = ModuleSource::text(
17        r#"
18        host = "localhost"
19        port = 8080
20        "#,
21    );
22
23    let server: Server = manager.evaluate_module_typed(&evaluator, source)?;
24    println!("Server: {server:?}");
25
26    // Evaluate a Pkl file (if it exists)
27    // let source = ModuleSource::file("config.pkl");
28    // let value = manager.evaluate_module(&evaluator, source)?;
29    // println!("Value: {value:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
More examples
Hide additional examples
examples/multiple_modules.rs (lines 27-36)
22fn main() -> Result<(), Box<dyn std::error::Error>> {
23    let mut manager = EvaluatorManager::new()?;
24    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
25
26    // First module: database config
27    let db: DbConfig = manager.evaluate_module_typed(
28        &evaluator,
29        ModuleSource::text(
30            r#"
31            host = "db.internal"
32            port = 5432
33            name = "myapp_production"
34            "#,
35        ),
36    )?;
37    println!("Database: {db:?}");
38
39    // Second module: cache config
40    let cache: CacheConfig = manager.evaluate_module_typed(
41        &evaluator,
42        ModuleSource::text(
43            r#"
44            host = "redis.internal"
45            port = 6379
46            ttl = 3600
47            "#,
48        ),
49    )?;
50    println!("Cache: {cache:?}");
51
52    manager.close_evaluator(&evaluator)?;
53    Ok(())
54}
examples/typed_eval.rs (line 42)
21fn main() -> Result<(), Box<dyn std::error::Error>> {
22    let mut manager = EvaluatorManager::new()?;
23    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
24
25    let source = ModuleSource::text(
26        r#"
27        name = "my-service"
28        version = "2.1.0"
29        server {
30            host = "0.0.0.0"
31            port = 8443
32            maxConnections = 100
33        }
34        features = new Listing {
35            "auth"
36            "logging"
37            "metrics"
38        }
39        "#,
40    );
41
42    let config: AppConfig = manager.evaluate_module_typed(&evaluator, source)?;
43    println!("App: {} v{}", config.name, config.version);
44    println!("Server: {}:{}", config.server.host, config.server.port);
45    println!("Max connections: {}", config.server.max_connections);
46    println!("Features: {:?}", config.features);
47
48    manager.close_evaluator(&evaluator)?;
49    Ok(())
50}
Source

pub fn evaluate_expression( &mut self, evaluator: &Evaluator, source: ModuleSource, expr: Option<&str>, ) -> Result<PklValue>

Evaluate an expression within a module.

Examples found in repository?
examples/expressions.rs (line 22)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let mut manager = EvaluatorManager::new()?;
6    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
7
8    let source = ModuleSource::text(
9        r#"
10        name = "my-app"
11        port = 8080
12        url = "http://localhost:\(port)"
13        hosts = new Listing { "web-1"; "web-2"; "web-3" }
14        "#,
15    );
16
17    // Evaluate the whole module
18    let full = manager.evaluate_module(&evaluator, source.clone())?;
19    println!("Full module:\n{full:#?}\n");
20
21    // Evaluate a single expression
22    let name = manager.evaluate_expression(&evaluator, source.clone(), Some("name"))?;
23    println!("name = {name:?}");
24
25    let url = manager.evaluate_expression(&evaluator, source.clone(), Some("url"))?;
26    println!("url = {url:?}");
27
28    let hosts = manager.evaluate_expression(&evaluator, source, Some("hosts"))?;
29    println!("hosts = {hosts:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
Source

pub fn close_evaluator(&mut self, evaluator: &Evaluator) -> Result<()>

Close an evaluator.

Examples found in repository?
examples/basic.rs (line 31)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let mut manager = EvaluatorManager::new()?;
12    let opts = EvaluatorOptions::preconfigured();
13    let evaluator = manager.new_evaluator(opts)?;
14
15    // Evaluate inline Pkl text
16    let source = ModuleSource::text(
17        r#"
18        host = "localhost"
19        port = 8080
20        "#,
21    );
22
23    let server: Server = manager.evaluate_module_typed(&evaluator, source)?;
24    println!("Server: {server:?}");
25
26    // Evaluate a Pkl file (if it exists)
27    // let source = ModuleSource::file("config.pkl");
28    // let value = manager.evaluate_module(&evaluator, source)?;
29    // println!("Value: {value:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
More examples
Hide additional examples
examples/multiple_modules.rs (line 52)
22fn main() -> Result<(), Box<dyn std::error::Error>> {
23    let mut manager = EvaluatorManager::new()?;
24    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
25
26    // First module: database config
27    let db: DbConfig = manager.evaluate_module_typed(
28        &evaluator,
29        ModuleSource::text(
30            r#"
31            host = "db.internal"
32            port = 5432
33            name = "myapp_production"
34            "#,
35        ),
36    )?;
37    println!("Database: {db:?}");
38
39    // Second module: cache config
40    let cache: CacheConfig = manager.evaluate_module_typed(
41        &evaluator,
42        ModuleSource::text(
43            r#"
44            host = "redis.internal"
45            port = 6379
46            ttl = 3600
47            "#,
48        ),
49    )?;
50    println!("Cache: {cache:?}");
51
52    manager.close_evaluator(&evaluator)?;
53    Ok(())
54}
examples/typed_eval.rs (line 48)
21fn main() -> Result<(), Box<dyn std::error::Error>> {
22    let mut manager = EvaluatorManager::new()?;
23    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
24
25    let source = ModuleSource::text(
26        r#"
27        name = "my-service"
28        version = "2.1.0"
29        server {
30            host = "0.0.0.0"
31            port = 8443
32            maxConnections = 100
33        }
34        features = new Listing {
35            "auth"
36            "logging"
37            "metrics"
38        }
39        "#,
40    );
41
42    let config: AppConfig = manager.evaluate_module_typed(&evaluator, source)?;
43    println!("App: {} v{}", config.name, config.version);
44    println!("Server: {}:{}", config.server.host, config.server.port);
45    println!("Max connections: {}", config.server.max_connections);
46    println!("Features: {:?}", config.features);
47
48    manager.close_evaluator(&evaluator)?;
49    Ok(())
50}
examples/expressions.rs (line 31)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let mut manager = EvaluatorManager::new()?;
6    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
7
8    let source = ModuleSource::text(
9        r#"
10        name = "my-app"
11        port = 8080
12        url = "http://localhost:\(port)"
13        hosts = new Listing { "web-1"; "web-2"; "web-3" }
14        "#,
15    );
16
17    // Evaluate the whole module
18    let full = manager.evaluate_module(&evaluator, source.clone())?;
19    println!("Full module:\n{full:#?}\n");
20
21    // Evaluate a single expression
22    let name = manager.evaluate_expression(&evaluator, source.clone(), Some("name"))?;
23    println!("name = {name:?}");
24
25    let url = manager.evaluate_expression(&evaluator, source.clone(), Some("url"))?;
26    println!("url = {url:?}");
27
28    let hosts = manager.evaluate_expression(&evaluator, source, Some("hosts"))?;
29    println!("hosts = {hosts:?}");
30
31    manager.close_evaluator(&evaluator)?;
32    Ok(())
33}
examples/raw_values.rs (line 45)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let mut manager = EvaluatorManager::new()?;
9    let evaluator = manager.new_evaluator(EvaluatorOptions::preconfigured())?;
10
11    let source = ModuleSource::text(
12        r#"
13        name = "example"
14        port = 8080
15        debug = true
16        tags = new Listing { "web"; "api" }
17        "#,
18    );
19
20    let value = manager.evaluate_module(&evaluator, source)?;
21
22    // Access properties via the convenience method
23    if let Some(props) = value.as_properties() {
24        for (key, val) in &props {
25            match val {
26                PklValue::String(s) => println!("{key} = \"{s}\""),
27                PklValue::Int(n) => println!("{key} = {n}"),
28                PklValue::Bool(b) => println!("{key} = {b}"),
29                PklValue::List(items) => {
30                    let strs: Vec<_> = items.iter().filter_map(|v| v.as_str()).collect();
31                    println!("{key} = {strs:?}");
32                }
33                other => println!("{key} = {other:?}"),
34            }
35        }
36    }
37
38    // Direct value accessors
39    let name = value
40        .as_properties()
41        .and_then(|p| p.get("name").copied())
42        .and_then(|v| v.as_str());
43    println!("\nDirect access — name: {name:?}");
44
45    manager.close_evaluator(&evaluator)?;
46    Ok(())
47}

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<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, 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.