Add #[non_exhaustive] to core structs and enums ()

This commit is contained in:
Rushmore Mushambi 2024-04-02 22:12:08 +02:00 committed by GitHub
parent 09553baae0
commit 2fbb4f4617
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
433 changed files with 909 additions and 320 deletions

View file

@ -125,7 +125,7 @@ args = ["test", "--locked", "--no-default-features", "--features", "${_TEST_FEAT
[tasks.ci-api-integration-http]
category = "CI - INTEGRATION TESTS"
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http" }
env = { _TEST_API_ENGINE = "http", _TEST_FEATURES = "protocol-http,sql2", RUSTFLAGS = "--cfg surrealdb_unstable" }
run_task = "ci-api-integration"
[tasks.ci-api-integration-ws]
@ -135,7 +135,7 @@ run_task = "ci-api-integration"
[tasks.ci-api-integration-any]
category = "CI - INTEGRATION TESTS"
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http" }
env = { _TEST_API_ENGINE = "any", _TEST_FEATURES = "protocol-http,sql2", RUSTFLAGS = "--cfg surrealdb_unstable" }
run_task = "ci-api-integration"
#

View file

@ -15,6 +15,7 @@ use std::fmt::{self, Display, Formatter};
// Mutation is a single mutation to a table.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
#[revisioned(revision = 2)]
#[non_exhaustive]
pub enum TableMutation {
// Although the Value is supposed to contain a field "id" of Thing,
// we do include it in the first field for convenience.
@ -43,6 +44,7 @@ impl From<DefineTableStatement> for Value {
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct TableMutations(pub String, pub Vec<TableMutation>);
impl TableMutations {
@ -53,6 +55,7 @@ impl TableMutations {
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct DatabaseMutation(pub Vec<TableMutations>);
impl DatabaseMutation {
@ -70,6 +73,7 @@ impl Default for DatabaseMutation {
// Change is a set of mutations made to a table at the specific timestamp.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct ChangeSet(pub [u8; 10], pub DatabaseMutation);
impl TableMutation {
@ -180,6 +184,7 @@ impl Display for ChangeSet {
// WriteMutationSet is a set of mutations to be to a table at the specific timestamp.
#[revisioned(revision = 1)]
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Store, Hash)]
#[non_exhaustive]
pub struct WriteMutationSet(pub Vec<TableMutations>);
impl WriteMutationSet {

View file

@ -16,15 +16,18 @@ use std::collections::HashMap;
// value = serialized table mutations
type PreparedWrite = (Vec<u8>, Vec<u8>, Vec<u8>, crate::kvs::Val);
#[non_exhaustive]
pub struct Writer {
buf: Buffer,
}
#[non_exhaustive]
pub struct Buffer {
pub b: HashMap<ChangeKey, TableMutations>,
}
#[derive(Hash, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub struct ChangeKey {
pub ns: String,
pub db: String,

View file

@ -6,6 +6,7 @@ use trice::Instant;
/// A 'static view into the cancellation status of a Context.
#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct Cancellation {
deadline: Option<Instant>,
cancellations: Vec<Arc<AtomicBool>>,

View file

@ -2,6 +2,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
#[derive(Default, Clone)]
#[non_exhaustive]
pub struct Canceller {
/// A reference to the canceled value of a context.
cancelled: Arc<AtomicBool>,

View file

@ -50,6 +50,7 @@ impl<'a> From<&'a Value> for Cow<'a, Value> {
Cow::Borrowed(v)
}
}
#[non_exhaustive]
pub struct Context<'a> {
// An optional parent context.
parent: Option<&'a Context<'a>>,

View file

@ -3,6 +3,7 @@ use std::fmt;
use std::io;
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[non_exhaustive]
pub enum Reason {
Timedout,
Canceled,

View file

@ -10,6 +10,7 @@ pub trait Target {
}
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
#[non_exhaustive]
pub struct FuncTarget(pub String, pub Option<String>);
impl std::fmt::Display for FuncTarget {
@ -48,6 +49,7 @@ impl std::str::FromStr for FuncTarget {
}
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
#[non_exhaustive]
pub enum NetTarget {
Host(url::Host<String>, Option<u16>),
IPNet(ipnet::IpNet),
@ -123,6 +125,7 @@ impl std::str::FromStr for NetTarget {
}
#[derive(Debug, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum Targets<T: Target + Hash + Eq + PartialEq> {
None,
Some(HashSet<T>),
@ -154,6 +157,7 @@ impl<T: Target + Hash + Eq + PartialEq + std::fmt::Display> std::fmt::Display fo
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct Capabilities {
scripting: bool,
guest_access: bool,

View file

@ -1,5 +1,6 @@
/// LoggingLifecycle is used to create log messages upon creation, and log messages when it is dropped
#[doc(hidden)]
#[non_exhaustive]
pub struct LoggingLifecycle {
identifier: String,
}

View file

@ -10,6 +10,7 @@ use std::ops::{Add, Sub};
// have a better structure.
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize, PartialOrd, Hash, Store)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct ClusterMembership {
pub name: String,
// TiKV = TiKV TSO Timestamp as u64
@ -23,6 +24,7 @@ pub struct ClusterMembership {
Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize, Ord, PartialOrd, Hash, Store, Default,
)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct Timestamp {
pub value: u64,
}
@ -39,6 +41,7 @@ impl From<u64> for Timestamp {
// conflicts when you have Store and Key derive macros.
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize, PartialOrd, Hash, Key)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct KeyTimestamp {
pub value: u64,
}

View file

@ -6,6 +6,7 @@ use std::fmt::{self, Debug, Display};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub enum Action {
Create,
Update,
@ -24,6 +25,7 @@ impl Display for Action {
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct Notification {
/// The id of the LIVE query to which this notification belongs
pub id: Uuid,
@ -44,3 +46,14 @@ impl Display for Notification {
write!(f, "{}", obj)
}
}
impl Notification {
/// Construct a new notification
pub const fn new(id: Uuid, action: Action, result: Value) -> Self {
Self {
id,
action,
result,
}
}
}

View file

@ -17,6 +17,7 @@ use uuid::Uuid;
/// whether field/event/table queries should be processed (useful
/// when importing data, where these queries might fail).
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct Options {
/// Current Node ID
id: Option<Uuid>,
@ -51,6 +52,7 @@ pub struct Options {
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum Force {
All,
None,

View file

@ -10,6 +10,7 @@ use std::time::Duration;
pub(crate) const TOKEN: &str = "$surrealdb::private::sql::Response";
#[derive(Debug)]
#[non_exhaustive]
pub enum QueryType {
// Any kind of query
Other,
@ -21,6 +22,7 @@ pub enum QueryType {
/// The return value when running a query set on the database.
#[derive(Debug)]
#[non_exhaustive]
pub struct Response {
pub time: Duration,
pub result: Result<Value, Error>,
@ -44,6 +46,7 @@ impl Response {
#[serde(rename_all = "UPPERCASE")]
#[revisioned(revision = 1)]
#[doc(hidden)]
#[non_exhaustive]
pub enum Status {
Ok,
Err,
@ -73,6 +76,7 @@ impl Serialize for Response {
#[derive(Debug, Serialize, Deserialize)]
#[revisioned(revision = 1)]
#[doc(hidden)]
#[non_exhaustive]
pub struct QueryMethodResponse {
pub time: String,
pub status: Status,

View file

@ -7,6 +7,7 @@ use std::sync::Arc;
/// Specifies the current session information when processing a query.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[non_exhaustive]
pub struct Session {
/// The current session [`Auth`] information
pub au: Arc<Auth>,

View file

@ -25,6 +25,7 @@ pub(crate) struct Document<'a> {
pub(super) current: CursorDoc<'a>,
}
#[non_exhaustive]
pub struct CursorDoc<'a> {
pub(crate) ir: Option<IteratorRef>,
pub(crate) rid: Option<&'a Thing>,

View file

@ -10,7 +10,7 @@ use std::task::{Context, Poll};
pin_project! {
/// Future for the [`try_join_all_buffered`] function.
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct TryJoinAllBuffered<F, I>
#[non_exhaustive] pub struct TryJoinAllBuffered<F, I>
where
F: TryFuture,
I: Iterator<Item = F>,

View file

@ -23,8 +23,8 @@ pub static FFLAGS: FFlags = FFlags {
};
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
#[allow(dead_code)]
#[non_exhaustive]
pub struct FFlags {
pub change_feed_live_queries: FFlagEnabledStatus,
}
@ -33,6 +33,7 @@ pub struct FFlags {
/// All the fields are here as information for people investigating the feature flag.
#[allow(dead_code)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
pub struct FFlagEnabledStatus {
pub(crate) enabled_release: bool,
pub(crate) enabled_debug: bool,

View file

@ -4,6 +4,7 @@ use crate::sql::duration;
#[derive(Clone, Trace)]
#[js::class]
#[non_exhaustive]
pub struct Duration {
#[qjs(skip_trace)]
pub(crate) value: Option<duration::Duration>,

View file

@ -4,6 +4,7 @@ use js::class::Trace;
#[derive(Clone, Trace)]
#[js::class]
#[non_exhaustive]
pub struct Record {
#[qjs(skip_trace)]
pub(crate) value: thing::Thing,

View file

@ -3,6 +3,7 @@ use js::class::Trace;
#[derive(Clone, Trace)]
#[js::class]
#[non_exhaustive]
pub struct Uuid {
#[qjs(skip_trace)]
pub(crate) value: Option<uuid::Uuid>,

View file

@ -12,12 +12,14 @@ use super::classes::Blob;
pub type StreamItem = StdResult<Bytes, RequestError>;
#[derive(Clone)]
#[non_exhaustive]
pub enum BodyKind {
Buffer,
String,
Blob(String),
}
#[non_exhaustive]
pub enum BodyData {
Buffer(Bytes),
Stream(RefCell<ReadableStream<StreamItem>>),
@ -28,6 +30,7 @@ pub enum BodyData {
/// A struct representing the body mixin.
///
/// Implements [`FromJs`] for conversion from `Blob`, `ArrayBuffer`, any `TypedBuffer` and `String`.
#[non_exhaustive]
pub struct Body {
/// The type of body
pub kind: BodyKind,

View file

@ -8,6 +8,7 @@ use js::{
};
#[derive(Clone, Copy)]
#[non_exhaustive]
pub enum EndingType {
Transparent,
Native,
@ -78,6 +79,7 @@ fn normalize_type(mut ty: String) -> String {
#[derive(Clone, Trace)]
#[js::class]
#[non_exhaustive]
pub struct Blob {
pub(crate) mime: String,
// TODO: make bytes?

View file

@ -12,6 +12,7 @@ use std::{collections::HashMap, string::String as StdString};
use crate::fnc::script::fetch::classes::Blob;
#[derive(Clone)]
#[non_exhaustive]
pub enum FormDataValue<'js> {
String(String<'js>),
Blob {
@ -47,6 +48,7 @@ impl<'js> FormDataValue<'js> {
#[js::class]
#[derive(Clone, Trace)]
#[non_exhaustive]
pub struct FormData<'js> {
#[qjs(skip_trace)]
pub(crate) values: HashMap<StdString, Vec<FormDataValue<'js>>>,

View file

@ -11,6 +11,7 @@ use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
#[derive(Clone, Trace)]
#[js::class]
#[non_exhaustive]
pub struct Headers {
#[qjs(skip_trace)]
pub(crate) inner: HeaderMap,

View file

@ -6,6 +6,7 @@ use reqwest::Method;
use crate::fnc::script::fetch::{body::Body, RequestError};
#[derive(Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub enum RequestMode {
Navigate,
SameOrigin,
@ -43,6 +44,7 @@ impl<'js> FromJs<'js> for RequestMode {
}
#[derive(Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub enum RequestCredentials {
Omit,
SameOrigin,
@ -77,6 +79,7 @@ impl<'js> FromJs<'js> for RequestCredentials {
}
#[derive(Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub enum RequestCache {
Default,
NoStore,
@ -120,6 +123,7 @@ impl<'js> FromJs<'js> for RequestCache {
}
#[derive(Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub enum RequestRedirect {
Follow,
Error,
@ -154,6 +158,7 @@ impl<'js> FromJs<'js> for RequestRedirect {
}
#[derive(Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub enum ReferrerPolicy {
Empty,
NoReferrer,
@ -204,6 +209,7 @@ impl<'js> FromJs<'js> for ReferrerPolicy {
}
}
#[non_exhaustive]
pub struct RequestInit<'js> {
pub method: Method,
pub headers: Class<'js, Headers>,
@ -374,6 +380,7 @@ use reqwest::{header::HeaderName, Url};
#[allow(dead_code)]
#[js::class]
#[derive(Trace)]
#[non_exhaustive]
pub struct Request<'js> {
#[qjs(skip_trace)]
pub(crate) url: Url,

View file

@ -10,6 +10,7 @@ use crate::fnc::script::fetch::{classes::Headers, util};
/// Struct containing data from the init argument from the Response constructor.
#[derive(Clone)]
#[non_exhaustive]
pub struct ResponseInit<'js> {
// u16 instead of reqwest::StatusCode since javascript allows non valid status codes in some
// circumstances.

View file

@ -8,6 +8,7 @@ use js::{class::Trace, prelude::Opt, ArrayBuffer, Class, Ctx, Exception, Result,
#[allow(dead_code)]
#[derive(Clone, Copy)]
#[non_exhaustive]
pub enum ResponseType {
Basic,
Cors,
@ -29,6 +30,7 @@ use super::{Blob, Headers};
#[allow(dead_code)]
#[derive(Trace)]
#[js::class]
#[non_exhaustive]
pub struct Response<'js> {
#[qjs(skip_trace)]
pub(crate) body: Body,

View file

@ -15,6 +15,7 @@ use func::js_fetch;
// But with how we implement streams RequestError must be clone.
/// Error returned by the request.
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum RequestError {
Reqwest(Arc<reqwest::Error>),
}

View file

@ -4,6 +4,7 @@ use channel::Receiver;
use futures::{FutureExt, Stream, StreamExt};
/// A newtype struct over receiver implementing the [`Stream`] trait.
#[non_exhaustive]
pub struct ChannelStream<R>(Receiver<R>);
impl<R> Stream for ChannelStream<R> {
@ -17,6 +18,7 @@ impl<R> Stream for ChannelStream<R> {
}
/// A struct representing a Javascript `ReadableStream`.
#[non_exhaustive]
pub struct ReadableStream<R>(Pin<Box<dyn Stream<Item = R> + Send + Sync>>);
impl<R> ReadableStream<R> {

View file

@ -33,7 +33,7 @@ macro_rules! impl_stub_class {
mod $module{
use super::*;
pub struct $name;
#[non_exhaustive] pub struct $name;
impl<'js> Trace<'js> for $name{
fn trace<'a>(&self, _tracer: Tracer<'a, 'js>){}

View file

@ -14,6 +14,7 @@ pub fn platform() -> &'static str {
crate::env::os()
}
#[non_exhaustive]
pub struct Package;
impl ModuleDef for Package {

View file

@ -2,6 +2,7 @@ use super::run;
use crate::fnc::script::modules::impl_module_def;
mod sort;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -6,6 +6,7 @@ mod bcrypt;
mod pbkdf2;
mod scrypt;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -2,6 +2,7 @@ use super::super::fut;
use crate::fnc::script::modules::impl_module_def;
use js::prelude::Async;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -2,6 +2,7 @@ use super::super::fut;
use crate::fnc::script::modules::impl_module_def;
use js::prelude::Async;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -2,6 +2,7 @@ use super::super::fut;
use crate::fnc::script::modules::impl_module_def;
use js::prelude::Async;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -2,6 +2,7 @@ use super::super::fut;
use crate::fnc::script::modules::impl_module_def;
use js::prelude::Async;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -3,6 +3,7 @@ use crate::fnc::script::modules::impl_module_def;
mod from;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -2,6 +2,7 @@ use crate::fnc::script::modules::impl_module_def;
mod base64;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -3,6 +3,7 @@ use crate::fnc::script::modules::impl_module_def;
mod hash;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -2,6 +2,7 @@ use super::fut;
use crate::fnc::script::modules::impl_module_def;
use js::prelude::Async;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -26,6 +26,7 @@ mod time;
mod r#type;
mod vector;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -3,6 +3,7 @@ use crate::fnc::script::modules::impl_module_def;
mod email;
mod url;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -5,6 +5,7 @@ use crate::sql::value::Value;
mod uuid;
#[non_exhaustive]
pub struct Package;
impl js::module::ModuleDef for Package {

View file

@ -3,6 +3,7 @@ use js::{prelude::Rest, Ctx};
use super::super::run;
use crate::sql::value::Value;
#[non_exhaustive]
pub struct Package;
impl js::module::ModuleDef for Package {

View file

@ -2,6 +2,7 @@ use super::fut;
use crate::fnc::script::modules::impl_module_def;
use js::prelude::Async;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -6,6 +6,7 @@ mod is;
mod semver;
mod similarity;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -3,6 +3,7 @@ use crate::fnc::script::modules::impl_module_def;
mod inc;
mod set;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -3,6 +3,7 @@ use crate::fnc::script::modules::impl_module_def;
mod from;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -5,6 +5,7 @@ use js::prelude::Async;
mod is;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -4,6 +4,7 @@ use crate::fnc::script::modules::impl_module_def;
mod distance;
mod similarity;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -1,6 +1,7 @@
use super::run;
use crate::fnc::script::modules::impl_module_def;
#[non_exhaustive]
pub struct Package;
impl_module_def!(

View file

@ -9,6 +9,7 @@ use self::query::{QueryContext, QUERY_DATA_PROP_NAME};
mod functions;
pub mod query;
#[non_exhaustive]
pub struct Package;
#[js::function]

View file

@ -10,6 +10,7 @@ use js::{
#[js::class]
#[derive(Trace, Clone)]
#[non_exhaustive]
pub struct Query {
#[qjs(skip_trace)]
pub(crate) query: Subquery,
@ -18,6 +19,7 @@ pub struct Query {
}
#[derive(Default, Clone)]
#[non_exhaustive]
pub struct QueryVariables(pub BTreeMap<String, SurValue>);
impl QueryVariables {

View file

@ -19,6 +19,7 @@ pub use classes::Query;
pub const QUERY_DATA_PROP_NAME: &str = "__query_context__";
/// A class to carry the data to run subqueries.
#[non_exhaustive]
pub struct QueryContext<'js> {
pub context: &'js Context<'js>,
pub opt: &'js Options,

View file

@ -8,6 +8,7 @@ use super::{is_allowed, Action, Actor, Error, Level, Resource, Role};
#[derive(Clone, Default, Debug, Eq, PartialEq, PartialOrd, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct Auth {
actor: Actor,
}

View file

@ -6,6 +6,7 @@ use crate::dbs::Statement;
// TODO(sgirones): For now keep it simple. In the future, we will allow for custom roles and policies using a more exhaustive list of actions and resources.
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd)]
#[non_exhaustive]
pub enum Action {
View,
Edit,

View file

@ -16,6 +16,7 @@ use crate::sql::statements::{DefineTokenStatement, DefineUserStatement};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct Actor {
res: Resource,
roles: Vec<Role>,

View file

@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, Eq, PartialEq, PartialOrd, Deserialize, Serialize, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub enum Level {
#[default]
No,

View file

@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, Eq, PartialEq, PartialOrd, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub enum ResourceKind {
#[default]
Any,
@ -81,6 +82,7 @@ impl ResourceKind {
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub struct Resource(String, ResourceKind, Level);
impl std::fmt::Display for Resource {

View file

@ -9,6 +9,7 @@ use std::str::FromStr;
#[derive(Hash, Clone, Default, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub enum Role {
#[default]
Viewer,

View file

@ -19,6 +19,7 @@ pub use self::auth::*;
pub use self::entities::*;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("Invalid role '{0}'")]
InvalidRole(String),

View file

@ -9,6 +9,7 @@ use std::collections::HashMap;
pub static HEADER: Lazy<Header> = Lazy::new(|| Header::new(Algorithm::HS512));
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
#[non_exhaustive]
pub struct Claims {
#[serde(skip_serializing_if = "Option::is_none")]
pub iat: Option<i64>,

View file

@ -12,6 +12,7 @@ pub(crate) type Id = u32;
// This doesn't do any variable-length encoding, so it's not as space efficient as it could be.
// It is used to generate ids for any SurrealDB objects that need aliases (e.g. namespaces, databases, tables, indexes, etc.)
#[derive(Clone)]
#[non_exhaustive]
pub struct U32 {
state_key: Key,
available_ids: Option<RoaringBitmap>,

View file

@ -28,6 +28,7 @@ use serde::Serialize;
use std::sync::Arc;
#[derive(Debug, Clone, Default)]
#[non_exhaustive]
pub struct IndexKeyBase {
inner: Arc<Inner>,
}

View file

@ -32,6 +32,7 @@ pub trait BKeys: Default + Debug + Display + Sized {
fn compile(&mut self) {}
}
#[non_exhaustive]
pub struct SplitKeys<BK>
where
BK: BKeys,
@ -44,6 +45,7 @@ where
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub struct FstKeys {
i: Inner,
}
@ -285,6 +287,7 @@ impl Display for FstKeys {
}
#[derive(Default, Debug, Clone)]
#[non_exhaustive]
pub struct TrieKeys {
keys: Trie<Key, Payload>,
}

View file

@ -18,6 +18,7 @@ pub type Payload = u64;
type BStoredNode<BK> = StoredNode<BTreeNode<BK>>;
pub(in crate::idx) type BTreeStore<BK> = TreeStore<BTreeNode<BK>>;
#[non_exhaustive]
pub struct BTree<BK>
where
BK: BKeys,
@ -29,6 +30,7 @@ where
#[derive(Clone, Serialize, Deserialize)]
#[revisioned(revision = 2)]
#[non_exhaustive]
pub struct BState {
minimum_degree: u32,
root: Option<NodeId>,
@ -143,6 +145,7 @@ impl From<BStatistics> for Value {
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum BTreeNode<BK>
where
BK: BKeys + Clone,

View file

@ -279,6 +279,7 @@ impl KnnResultBuilder {
}
}
#[non_exhaustive]
pub struct KnnResult {
docs: VecDeque<DocId>,
#[cfg(debug_assertions)]
@ -288,6 +289,7 @@ pub struct KnnResult {
// https://en.wikipedia.org/wiki/M-tree
// https://arxiv.org/pdf/1004.4216.pdf
#[non_exhaustive]
pub struct MTree {
state: MState,
distance: Distance,
@ -1336,6 +1338,7 @@ type LeafMap = BTreeMap<SharedVector, ObjectProperties>;
/// Both LeafNodes and InternalNodes are implemented as a map.
/// In this map, the key is an object, and the values correspond to its properties.
/// In essence, an entry can be visualized as a tuple of the form (object, properties).
#[non_exhaustive]
pub enum MTreeNode {
Internal(InternalNode),
Leaf(LeafNode),
@ -1549,6 +1552,7 @@ impl From<MtStatistics> for Value {
#[derive(Clone, Serialize, Deserialize)]
#[revisioned(revision = 2)]
#[non_exhaustive]
pub struct MState {
capacity: u16,
root: Option<NodeId>,
@ -1570,6 +1574,7 @@ impl MState {
}
#[derive(Clone, Serialize, Deserialize, Debug)]
#[non_exhaustive]
pub struct RoutingProperties {
// Reference to the node
node: NodeId,
@ -1580,6 +1585,7 @@ pub struct RoutingProperties {
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[non_exhaustive]
pub struct ObjectProperties {
// Distance to its parent object
parent_dist: f64,

View file

@ -79,6 +79,7 @@ where
}
#[derive(Clone)]
#[non_exhaustive]
pub enum TreeCache<N>
where
N: TreeNode + Debug + Clone + Display,
@ -117,6 +118,7 @@ where
}
}
#[non_exhaustive]
pub struct TreeLruCache<N>
where
N: TreeNode + Debug + Clone + Display,
@ -165,6 +167,7 @@ where
}
}
#[non_exhaustive]
pub struct TreeFullCache<N>
where
N: TreeNode + Debug + Clone,

View file

@ -17,6 +17,7 @@ use std::sync::Arc;
pub type NodeId = u64;
#[non_exhaustive]
pub enum TreeStore<N>
where
N: TreeNode + Debug + Clone,
@ -98,6 +99,7 @@ where
}
#[derive(Clone)]
#[non_exhaustive]
pub enum TreeNodeProvider {
DocIds(IndexKeyBase),
DocLengths(IndexKeyBase),
@ -143,6 +145,7 @@ impl TreeNodeProvider {
}
}
#[non_exhaustive]
pub struct StoredNode<N>
where
N: Clone + Display,
@ -184,6 +187,7 @@ pub trait TreeNode: Debug + Clone + Display {
}
#[derive(Clone)]
#[non_exhaustive]
pub struct IndexStores(Arc<Inner>);
struct Inner {

View file

@ -6,6 +6,7 @@ use std::collections::{HashMap, HashSet};
use std::fmt::{Debug, Display};
use std::sync::Arc;
#[non_exhaustive]
pub struct TreeWrite<N>
where
N: TreeNode + Debug + Clone,
@ -147,6 +148,7 @@ where
}
}
#[non_exhaustive]
pub struct TreeRead<N>
where
N: TreeNode + Debug + Clone,

View file

@ -11,6 +11,7 @@ use std::sync::Arc;
/// In the context of a Symmetric MTree index, the term object refers to a vector, representing the indexed item.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[revisioned(revision = 1)]
#[non_exhaustive]
pub enum Vector {
F64(Vec<f64>),
F32(Vec<f32>),

View file

@ -10,6 +10,7 @@ use std::str;
// Cf stands for change feeds
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Cf<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct All<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Az<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Fc<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Ml<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Pa<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Sc<'a> {
__: u8,
_a: u8,

View file

@ -5,6 +5,7 @@ use derive::Key;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Tb<'a> {
__: u8,
_a: u8,

View file

@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
// Table ID generator
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Key)]
#[non_exhaustive]
pub struct Ti {
__: u8,
_a: u8,

Some files were not shown because too many files have changed in this diff Show more