Skip to content

Commit

Permalink
doc: use doc inline for exported apis
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Oct 30, 2023
1 parent dfd655d commit 05b560d
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lazyvalue/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'de> JsonValue for LazyValue<'de> {
}
}

fn get<I: crate::Index>(&self, index: I) -> Option<Self::ValueType<'_>> {
fn get<I: crate::value::Index>(&self, index: I) -> Option<Self::ValueType<'_>> {
index.lazyvalue_index_into(self)
}

Expand Down
33 changes: 28 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,32 @@ pub mod value;
pub mod visitor;
pub mod writer;

pub use crate::error::*;
pub use crate::pointer::*;
#[doc(inline)]
pub use crate::error::{Error, Result};

pub use crate::lazyvalue::*;
pub use crate::serde::*;
pub use crate::value::*;
#[doc(inline)]
pub use crate::lazyvalue::{
get, get_from_bytes, get_from_bytes_unchecked, get_from_faststr, get_from_faststr_unchecked,
get_from_slice, get_from_slice_unchecked, get_from_str, get_from_str_unchecked, get_many,
get_many_unchecked, get_unchecked, to_array_iter, to_object_iter, ArrayIntoIter, LazyValue,
ObjectIntoIter,
};

#[doc(inline)]
pub use crate::pointer::{JsonPointer, PointerNode, PointerTrait, PointerTree};

#[doc(inline)]
pub use crate::serde::{
from_slice, from_slice_unchecked, from_str, to_raw_value, to_string, to_string_pretty, to_vec,
to_vec_pretty, to_writer, to_writer_pretty, Deserializer, JsonNumberTrait, Number, RawNumber,
RawValue, Serializer,
};

#[doc(inline)]
pub use crate::value::{
dom_from_slice, dom_from_slice_unchecked, dom_from_str, Array, ArrayMut, Document, JsonType,
JsonValue, Object, ObjectMut, Value, ValueMut,
};

// re-export the serde trait
pub use ::serde::{Deserialize, Serialize};
3 changes: 0 additions & 3 deletions src/serde/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ pub use self::ser::{

pub(crate) use self::de::tri;

// re-export serde trait
pub use serde::{Deserialize, Serialize};

#[cfg(test)]
#[allow(clippy::mutable_key_type)]
mod test {
Expand Down
1 change: 1 addition & 0 deletions src/serde/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ impl Hash for N {
}
}

/// Number trait for both `Number` and `RawNumber`.
pub trait JsonNumberTrait: Sealed {
fn is_i64(&self) -> bool;
fn is_u64(&self) -> bool;
Expand Down
7 changes: 4 additions & 3 deletions src/util/utf8.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::Error;
use crate::ErrorCode;
use crate::{error::Result, reader::Position};
use crate::{
error::{Error, ErrorCode, Result},
reader::Position,
};

#[inline(always)]
pub(crate) fn from_utf8(data: &[u8]) -> Result<&str> {
Expand Down
2 changes: 1 addition & 1 deletion src/value/index.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{value::Value, LazyValue};
use crate::{lazyvalue::LazyValue, value::Value};
use core::ops;

pub trait Index: private::Sealed {
Expand Down
5 changes: 3 additions & 2 deletions src/value/node.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use super::value_trait::{JsonType, JsonValue};
use super::Index;
use super::IndexMut;
use crate::error::Result;
use crate::parser::Parser;
use crate::pointer::{JsonPointer, PointerNode};
use crate::reader::UncheckedSliceRead;
use crate::serde::tri;
use crate::util::utf8::from_utf8;
use crate::value::Index;
use crate::visitor::JsonVisitor;
use crate::{to_string, IndexMut, Number};
use crate::{to_string, Number};
use bumpalo::Bump;
use core::mem::size_of;
use serde::ser::{Error, Serialize, SerializeMap, SerializeSeq};
Expand Down
2 changes: 1 addition & 1 deletion src/value/value_trait.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{Index, JsonNumberTrait, JsonPointer, Number};
use crate::{value::Index, JsonNumberTrait, JsonPointer, Number};

/// JsonType is an enum that represents the type of a JSON value.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
Expand Down

0 comments on commit 05b560d

Please sign in to comment.