Skip to content

Commit

Permalink
bump fusio to 0.3.0 & basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ethe committed Oct 25, 2024
1 parent d2a5e7c commit cbe9447
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
4 changes: 2 additions & 2 deletions fusio-dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition.workspace = true
license.workspace = true
name = "fusio-dispatch"
repository.workspace = true
version = "0.2.0"
version = "0.2.1"

[features]
aws = ["fusio/aws"]
Expand All @@ -14,6 +14,6 @@ object_store = ["dep:fusio-object-store", "object_store/aws"]
tokio = ["fusio/tokio"]

[dependencies]
fusio = { version = "0.2.1", path = "../fusio" }
fusio = { version = "0.3.0", path = "../fusio" }
fusio-object-store = { version = "0.2.0", path = "../fusio-object-store", optional = true }
object_store = { version = "0.11", optional = true }
4 changes: 2 additions & 2 deletions fusio-object-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ edition.workspace = true
license.workspace = true
name = "fusio-object-store"
repository.workspace = true
version = "0.2.0"
version = "0.2.1"

[dependencies]
async-stream = { version = "0.3" }
fusio = { version = "0.2.1", path = "../fusio", features = [
fusio = { version = "0.3.0", path = "../fusio", features = [
"bytes",
"dyn",
"object_store",
Expand Down
4 changes: 2 additions & 2 deletions fusio-parquet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ edition.workspace = true
license.workspace = true
name = "fusio-parquet"
repository.workspace = true
version = "0.2.0"
version = "0.2.1"

[dependencies]
bytes = { workspace = true }
fusio = { version = "0.2.1", path = "../fusio", features = [
fusio = { version = "0.3.0", path = "../fusio", features = [
"bytes",
"dyn",
"tokio",
Expand Down
3 changes: 2 additions & 1 deletion fusio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ description = "Fusio provides lean, minimal cost abstraction and extensible Read
edition.workspace = true
license.workspace = true
name = "fusio"
readme = "../README.md"
repository.workspace = true
version = "0.2.1"
version = "0.3.0"

[features]
aws = [
Expand Down
32 changes: 32 additions & 0 deletions fusio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub use dynamic::{DynRead, DynWrite};
pub use error::Error;
pub use impls::*;

/// Considering lots of runtimes does not require `Send`for `Future` and `Stream`,
/// we provide a trait to represent the future or stream that may not require `Send`.
/// Users could switch the feature `no-send` at compile-time to disable the `Send` bound for `Future` and `Stream`.
/// # Safety
/// Do not implement it directly
#[cfg(not(feature = "no-send"))]
Expand All @@ -32,6 +35,7 @@ unsafe impl<T: Send> MaybeSend for T {}
#[cfg(feature = "no-send")]
unsafe impl<T> MaybeSend for T {}

/// Same as `MaybeSend`, but for `Sync`.
/// # Safety
/// Do not implement it directly
#[cfg(not(feature = "no-send"))]
Expand All @@ -48,6 +52,21 @@ unsafe impl<T: Sync> MaybeSync for T {}
unsafe impl<T> MaybeSync for T {}

pub trait Write: MaybeSend {
//! The core trait for writing data,
//! it is similar to [`std::io::Write`], but it takes the ownership of the buffer,
//! because completion-based IO requires the buffer to be pinned and should be safe to cancellation.
//!
//! [`Write`] represents "truncate to 0 then append all" semantics,
//! which means the file will be truncated to 0 at first,
//! and each write operation will be appended to the end of the file.
//!
//! Contents are not be garanteed to be written to the file until the [`Write::close`] method is called,
//! [`Write::flush`] may be used to flush the data to the file in some implementations,
//! but not all implementations will do so.
//!
//! Whether the operation is successful or not, the buffer will be returned,
//! [`fusio`] promises that the returned buffer will be the same as the input buffer.
fn write_all<B: IoBuf>(
&mut self,
buf: B,
Expand All @@ -59,6 +78,19 @@ pub trait Write: MaybeSend {
}

pub trait Read: MaybeSend + MaybeSync {
//! The core trait for reading data,
//! it is similar to [`std::io::Read`],
//! but it takes the ownership of the buffer,
//! because completion-based IO requires the buffer to be pinned and should be safe to cancellation.
//!
//! [`Read`] represents "read exactly at" semantics,
//! which means the read operation will start at the specified position.
//!
//! The buffer will be returned with the result, whether the operation is successful or not,
//! [`fusio`] promises that the returned buffer will be the same as the input buffer.
//!
//! If you want sequential reading, try [`SeqRead`].
fn read_exact_at<B: IoBufMut>(
&mut self,
buf: B,
Expand Down

0 comments on commit cbe9447

Please sign in to comment.