Skip to main content

parse_rust_core/
lib.rs

1//! Parse type system, JSON encoding and error codes. No I/O.
2//!
3//! This crate is the bottom of the workspace: it depends on no other parse-rust crate and
4//! performs no I/O, so everything in it is directly testable without a server or a database.
5//!
6//! The contract for the whole project is **wire compatibility**: an unmodified Parse SDK
7//! pointed at parse-rust must see the same bytes it sees from parse-server. That is why this
8//! crate carries an ECMAScript number formatter, an order-preserving map, and a hand-written
9//! equality predicate rather than the obvious Rust defaults for each. See
10//! the modules below, each of which states the upstream behavior it reproduces.
11//!
12//! Citations of the form `File.js:LINE` refer to parse-server at pin `ca75b1fe`, recorded in
13//! `PIN` at the repository root. Read them with `git -C ../parse-server show ca75b1fe:<path>`.
14
15#![forbid(unsafe_code)]
16// "No `unwrap()` or `panic!()` in request paths": a malformed request from an untrusted client
17// must never take down a worker. Scoped to non-test builds on purpose. A test that cannot
18// assert with `unwrap` is a test written to satisfy a lint rather than to catch a bug, and the
19// invariant being protected is about serving traffic, not about test code.
20#![cfg_attr(
21    not(test),
22    deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)
23)]
24
25pub mod acl;
26pub mod clp;
27pub mod date;
28pub mod decode;
29pub mod error;
30pub mod js_number;
31pub mod object_id;
32pub mod op;
33pub mod value;
34
35pub use acl::{Acl, Permissions, Principal};
36pub use clp::{
37    is_js_truthy, ClassLevelPermissions, OpEntity, OpPerm, Operation, PfEntity, UserFieldsKey,
38};
39pub use date::ParseDate;
40pub use decode::{classify, classify_raw, recognize_atom, AtomPosition};
41pub use error::{
42    ErrorCode, ErrorDetail, ErrorOrigin, ParseError, ParseErrorInfo, DUPLICATE_VALUE_MESSAGE,
43    PERMISSION_DENIED,
44};
45pub use object_id::new_object_id;
46pub use op::{classify_field, FieldWrite, Op};
47pub use value::{
48    base64_decode, base64_encode, deep_strict_eq, is_base64_value, ParseMap, ParseValue,
49};