Skip to content

Commit

Permalink
read: use BoundedBufMut for more flexibility at call sites (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
problame authored Dec 12, 2023
1 parent 43cad2a commit 2ae71ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tokio-epoll-uring/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub use system::lifecycle::thread_local::{thread_local_system, Handle};
pub use system::lifecycle::System;
pub use system::submission::op_fut::Error as SystemError;

pub use uring_common::buf::{IoBuf, IoBufMut};
pub use uring_common::buf::{BoundedBuf, BoundedBufMut, IoBuf, IoBufMut, Slice};
pub use uring_common::io_fd::IoFd;

pub(crate) mod util;
Expand Down
10 changes: 5 additions & 5 deletions tokio-epoll-uring/src/ops/read.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::os::fd::AsRawFd;

use uring_common::{buf::IoBufMut, io_fd::IoFd, io_uring};
use uring_common::{buf::BoundedBufMut, io_fd::IoFd, io_uring};

use crate::system::submission::op_fut::Op;

pub struct ReadOp<F, B>
where
F: IoFd + Send,
B: IoBufMut + Send,
B: BoundedBufMut + Send,
{
pub(crate) file: F,
pub(crate) offset: u64,
Expand All @@ -17,14 +17,14 @@ where
impl<F, B> crate::sealed::Sealed for ReadOp<F, B>
where
F: IoFd + Send,
B: IoBufMut + Send,
B: BoundedBufMut + Send,
{
}

impl<F, B> Op for ReadOp<F, B>
where
F: IoFd + Send,
B: IoBufMut + Send,
B: BoundedBufMut + Send,
{
type Resources = (F, B);
type Success = usize;
Expand Down Expand Up @@ -59,7 +59,7 @@ where
let res = if res < 0 {
Err(std::io::Error::from_raw_os_error(-res))
} else {
unsafe { IoBufMut::set_init(&mut self.buf, res as usize) };
unsafe { BoundedBufMut::set_init(&mut self.buf, res as usize) };
Ok(res as usize)
};
((self.file, self.buf), res)
Expand Down
4 changes: 2 additions & 2 deletions tokio-epoll-uring/src/system/lifecycle/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use futures::FutureExt;
use std::{os::fd::OwnedFd, path::Path, task::ready};
use uring_common::{buf::IoBufMut, io_fd::IoFd};
use uring_common::{buf::BoundedBufMut, io_fd::IoFd};

use crate::{
ops::{open_at::OpenAtOp, read::ReadOp},
Expand Down Expand Up @@ -104,7 +104,7 @@ impl crate::SystemHandle {
let inner = self.inner.as_ref().unwrap();
execute_op(op, inner.submit_side.weak(), None)
}
pub fn read<F: IoFd + Send, B: IoBufMut + Send>(
pub fn read<F: IoFd + Send, B: BoundedBufMut + Send>(
&self,
file: F,
offset: u64,
Expand Down

0 comments on commit 2ae71ce

Please sign in to comment.