Ensure dbs::Capabilities
are visible in Rust docs (#2593)
This commit is contained in:
parent
87a9631898
commit
576996aafd
5 changed files with 47 additions and 1 deletions
6
lib/src/api/opt/capabilities.rs
Normal file
6
lib/src/api/opt/capabilities.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
//! The capabilities that can be enabled for a database instance
|
||||||
|
|
||||||
|
pub use crate::dbs::capabilities::FuncTarget;
|
||||||
|
pub use crate::dbs::capabilities::NetTarget;
|
||||||
|
pub use crate::dbs::capabilities::Targets;
|
||||||
|
pub use crate::dbs::Capabilities;
|
|
@ -1,6 +1,7 @@
|
||||||
//! The different options and types for use in API functions
|
//! The different options and types for use in API functions
|
||||||
|
|
||||||
pub mod auth;
|
pub mod auth;
|
||||||
|
pub mod capabilities;
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
mod endpoint;
|
mod endpoint;
|
||||||
|
|
|
@ -6,7 +6,7 @@ use once_cell::sync::Lazy;
|
||||||
pub const MAX_CONCURRENT_TASKS: usize = 64;
|
pub const MAX_CONCURRENT_TASKS: usize = 64;
|
||||||
|
|
||||||
/// Specifies how deep various forms of computation will go before the query fails
|
/// Specifies how deep various forms of computation will go before the query fails
|
||||||
/// with [`Error::ComputationDepthExceeded`].
|
/// with [`crate::error::Db::ComputationDepthExceeded`].
|
||||||
///
|
///
|
||||||
/// For reference, use ~15 per MiB of stack in release mode.
|
/// For reference, use ~15 per MiB of stack in release mode.
|
||||||
///
|
///
|
||||||
|
|
|
@ -174,6 +174,44 @@ impl<T: Target + Hash + Eq + PartialEq + std::fmt::Display> std::fmt::Display fo
|
||||||
/// - Allow all functions except `http.*`: `--allow-funcs --deny-funcs 'http.*'`
|
/// - Allow all functions except `http.*`: `--allow-funcs --deny-funcs 'http.*'`
|
||||||
/// - Allow all network addresses except AWS metadata endpoint: `--allow-net --deny-net='169.254.169.254'`
|
/// - Allow all network addresses except AWS metadata endpoint: `--allow-net --deny-net='169.254.169.254'`
|
||||||
///
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// Create a new instance, and allow all capabilities
|
||||||
|
/// ```no_run
|
||||||
|
/// # use surrealdb::opt::capabilities::Capabilities;
|
||||||
|
/// # use surrealdb::opt::Config;
|
||||||
|
/// # use surrealdb::Surreal;
|
||||||
|
/// # use surrealdb::engine::local::File;
|
||||||
|
/// # #[tokio::main]
|
||||||
|
/// # async fn main() -> surrealdb::Result<()> {
|
||||||
|
/// let capabilities = Capabilities::all();
|
||||||
|
/// let config = Config::default().capabilities(capabilities);
|
||||||
|
/// let db = Surreal::new::<File>(("temp.db", config)).await?;
|
||||||
|
/// # Ok(())
|
||||||
|
/// # }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Create a new instance, and allow certain functions
|
||||||
|
/// ```no_run
|
||||||
|
/// # use std::str::FromStr;
|
||||||
|
/// # use surrealdb::engine::local::File;
|
||||||
|
/// # use surrealdb::opt::capabilities::Capabilities;
|
||||||
|
/// # use surrealdb::opt::capabilities::FuncTarget;
|
||||||
|
/// # use surrealdb::opt::capabilities::Targets;
|
||||||
|
/// # use surrealdb::opt::Config;
|
||||||
|
/// # use surrealdb::Surreal;
|
||||||
|
/// # #[tokio::main]
|
||||||
|
/// # async fn main() -> surrealdb::Result<()> {
|
||||||
|
/// let capabilities = Capabilities::default()
|
||||||
|
/// .with_functions(Targets::<FuncTarget>::All)
|
||||||
|
/// .without_functions(Targets::<FuncTarget>::Some(
|
||||||
|
/// [FuncTarget::from_str("http::*").unwrap()].into(),
|
||||||
|
/// ));
|
||||||
|
/// let config = Config::default().capabilities(capabilities);
|
||||||
|
/// let db = Surreal::new::<File>(("temp.db", config)).await?;
|
||||||
|
/// # Ok(())
|
||||||
|
/// # }
|
||||||
|
/// ```
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Capabilities {
|
pub struct Capabilities {
|
||||||
scripting: bool,
|
scripting: bool,
|
||||||
|
|
|
@ -87,6 +87,7 @@ pub use self::block::Block;
|
||||||
pub use self::bytes::Bytes;
|
pub use self::bytes::Bytes;
|
||||||
pub use self::cast::Cast;
|
pub use self::cast::Cast;
|
||||||
pub use self::cond::Cond;
|
pub use self::cond::Cond;
|
||||||
|
pub use self::constant::Constant;
|
||||||
pub use self::data::Data;
|
pub use self::data::Data;
|
||||||
pub use self::datetime::Datetime;
|
pub use self::datetime::Datetime;
|
||||||
pub use self::dir::Dir;
|
pub use self::dir::Dir;
|
||||||
|
|
Loading…
Reference in a new issue