Skip to main content

AppSettings

Trait AppSettings 

Source
pub trait AppSettings:
    Send
    + Sync
    + 'static {
    // Required method
    fn defs(&self) -> Vec<SettingDef>;

    // Provided methods
    fn names(&self) -> &[&str] { ... }
    fn http_endpoints(&self) -> Vec<HttpEndpoint> { ... }
    fn validate(
        &self,
        _files: &AppFiles,
        _staged: &Staged,
    ) -> Result<(), Vec<FieldError>> { ... }
}
Expand description

An application’s own settings: what they are, and a check of the edited files as a whole.

Every key starts with the application’s name and a dot, or with one of the top-level names it declares (names); it lives on the device or in the workspace (not in the workgroup), and a secret lives on the device only. Where the files are is the framework’s business. () is an application with no settings of its own.

Required Methods§

Source

fn defs(&self) -> Vec<SettingDef>

The application’s settings, in the order a listing shows them.

Provided Methods§

Source

fn names(&self) -> &[&str]

The top-level names the application takes beside its own: tables such as anthropic for [anthropic], or a bare key such as day_boundary_hour. None of them may be one the framework or the bridge keeps.

Source

fn http_endpoints(&self) -> Vec<HttpEndpoint>

The HTTP endpoints the application serves with AppServer::http_endpoint: each gets an http.<name>.enabled setting, off by default, and is served at /<name> only while it is on.

Source

fn validate( &self, _files: &AppFiles, _staged: &Staged, ) -> Result<(), Vec<FieldError>>

Check the edited files as a whole, before anything is written; also run once when the server starts, against the files as they are.

files says where the application’s files are; staged.read(path) gives a file as the write would leave it, falling back to what is on disk for a file the write does not touch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AppSettings for ()

Implementors§