From 3c83761ec6deeaf2d9858961d7324b80a3a63158 Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Thu, 12 Jan 2023 21:58:55 +0800 Subject: [PATCH] better inline docs --- cozo-core/src/lib.rs | 1 + cozo-core/src/parse/mod.rs | 11 ++++++----- cozo-core/src/runtime/db.rs | 3 --- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cozo-core/src/lib.rs b/cozo-core/src/lib.rs index a794ec28..20fa3b80 100644 --- a/cozo-core/src/lib.rs +++ b/cozo-core/src/lib.rs @@ -66,6 +66,7 @@ pub use storage::{Storage, StoreTx}; pub use crate::data::expr::Expr; use crate::data::json::JsonValue; pub use crate::data::symb::Symbol; +pub use crate::parse::SourceSpan; pub use crate::runtime::callback::CallbackOp; pub use crate::runtime::db::Poison; diff --git a/cozo-core/src/parse/mod.rs b/cozo-core/src/parse/mod.rs index 755cb8c0..2b4b627c 100644 --- a/cozo-core/src/parse/mod.rs +++ b/cozo-core/src/parse/mod.rs @@ -6,12 +6,12 @@ * You can obtain one at https://mozilla.org/MPL/2.0/. */ -use either::Either; use std::cmp::{max, min}; use std::collections::{BTreeMap, BTreeSet}; use std::fmt::{Display, Formatter}; use std::sync::Arc; +use either::Either; use miette::{bail, Diagnostic, IntoDiagnostic, Result}; use pest::error::InputLocation; use pest::Parser; @@ -104,7 +104,7 @@ impl ImperativeStmt { if let Some(name) = prog.needs_write_lock() { collector.insert(name); } - }, + } ImperativeStmt::If { condition, then_branch, @@ -124,13 +124,13 @@ impl ImperativeStmt { for prog in body { prog.needs_write_locks(collector); } - }, + } ImperativeStmt::TempDebug { .. } | ImperativeStmt::ReturnTemp { .. } | ImperativeStmt::Break { .. } | ImperativeStmt::Continue { .. } | ImperativeStmt::ReturnNil { .. } - | ImperativeStmt::TempSwap { .. } => {}, + | ImperativeStmt::TempSwap { .. } => {} } } } @@ -150,10 +150,11 @@ impl CozoScript { } } +/// Span of the element in the source script, with starting and ending positions. #[derive( Eq, PartialEq, Debug, serde_derive::Serialize, serde_derive::Deserialize, Copy, Clone, Default, )] -pub struct SourceSpan(pub(crate) usize, pub(crate) usize); +pub struct SourceSpan(pub usize, pub usize); impl Display for SourceSpan { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { diff --git a/cozo-core/src/runtime/db.rs b/cozo-core/src/runtime/db.rs index 6689088d..efbfb04c 100644 --- a/cozo-core/src/runtime/db.rs +++ b/cozo-core/src/runtime/db.rs @@ -203,9 +203,6 @@ impl<'s, S: Storage<'s>> Db { /// Export relations to JSON data. /// /// `relations` contains names of the stored relations to export. - /// - /// If `as_objects` is `true`, then the output contains objects (maps) for each row, - /// otherwise the output contains arrays for each row, with headers attached separately. pub fn export_relations<'a>( &'s self, relations: impl Iterator,