Skip to content

Commit

Permalink
re-organize crate a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Dec 20, 2023
1 parent 338ef0e commit 193d566
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions buffer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ mod std {
}

mod fragments;
mod stream;
pub mod stream;
mod value;

#[cfg(feature = "alloc")]
fn assert_static<T: 'static>(_: &mut T) {}

pub use self::{error::*, fragments::*, stream::*, value::*};
pub use self::{error::*, fragments::*, stream::Stream, value::*};
4 changes: 3 additions & 1 deletion buffer/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use self::flat::FlatStream;
mod flat;
mod flat_enum;

pub use sval_ref::{Ref, ValueRef};

pub trait Stream<'sval> {
type Ok;

Expand Down Expand Up @@ -718,7 +720,7 @@ pub mod default_stream {
let mut seq = stream.seq_begin(Some(binary.len()))?;

for b in binary {
seq.value_computed(b)?;
StreamSeq::value_computed(&mut seq, b)?;
}

seq.end()
Expand Down
16 changes: 8 additions & 8 deletions buffer/src/stream/flat.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use core::{fmt, marker::PhantomData, mem};

use crate::{
BinaryBuf, Error, Result, Stream, StreamEnum, StreamMap, StreamRecord, StreamSeq, StreamTuple,
TextBuf, ValueBuf,
stream::{Stream, StreamEnum, StreamMap, StreamRecord, StreamSeq, StreamTuple},
BinaryBuf, Error, Result, TextBuf, ValueBuf,
};

use super::{flat_enum::FlatStreamEnum, owned_label_ref};
Expand Down Expand Up @@ -822,9 +822,9 @@ impl<'sval, S: Stream<'sval>> State<'sval, S> {
self.value_with(
|stream| any(stream, value),
|stream, tag, label, index| stream.tagged(tag, label, index, value),
|stream| stream.value(value),
|stream| stream.key(value),
|stream| stream.value(value),
|stream| StreamSeq::value(stream, value),
|stream| StreamMap::key(stream, value),
|stream| StreamMap::value(stream, value),
|stream, tag, index| stream.value(tag, index, value),
|stream, tag, label| stream.value(tag, label, value),
|stream, tag, label, index| stream.tagged(tag, label, index, value),
Expand All @@ -841,9 +841,9 @@ impl<'sval, S: Stream<'sval>> State<'sval, S> {
self.value_with(
|stream| any(stream, value),
|stream, tag, label, index| stream.tagged_computed(tag, label, index, value),
|stream| stream.value_computed(value),
|stream| stream.key_computed(value),
|stream| stream.value_computed(value),
|stream| StreamSeq::value_computed(stream, value),
|stream| StreamMap::key_computed(stream, value),
|stream| StreamMap::value_computed(stream, value),
|stream, tag, index| stream.value_computed(tag, index, value),
|stream, tag, label| stream.value_computed(tag, label, value),
|stream, tag, label, index| stream.tagged_computed(tag, label, index, value),
Expand Down
5 changes: 4 additions & 1 deletion buffer/src/stream/flat_enum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::{default_stream, Error, Result, Stream, StreamEnum, Unsupported};
use crate::{
stream::{default_stream, Stream, StreamEnum, Unsupported},
Error, Result,
};

use super::owned_label;

Expand Down
2 changes: 1 addition & 1 deletion serde/src/to_serialize.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::ser::{Error as _, Serialize as _};

use sval_buffer::{
use sval_buffer::stream::{
Stream, StreamEnum, StreamMap, StreamRecord, StreamSeq, StreamTuple, Unsupported,
};

Expand Down

0 comments on commit 193d566

Please sign in to comment.