Rust

Crate root

Module
What utopia_dsn defines at its root.

Contents

use utopia_dsn::Dsn;
Rust
pub struct Dsn {
    // private fields
}

A parsed DSN.

Its `Debug` output hides the password
Rust
use utopia_dsn::Dsn;

let dsn = Dsn::parse("redis://default:secret@cache:6379")?;
let printed = format!("{dsn:?}");
assert!(printed.contains("cache"));
assert!(!printed.contains("secret"));
PHP
use Utopia\DSN\DSN;

$dsn = new DSN('redis://default:secret@cache:6379');
echo $dsn->getHost(), "\n"; // cache
Also implements Display, Debug.
use utopia_dsn::Error;
Rust
pub enum Error {
    InvalidArgument(&'static str),
    Type(&'static str),
}

Why a DSN was refused or a parameter could not be read.