Skip to content

Commit

Permalink
fix: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
ben1009 committed Jul 21, 2023
1 parent 608b96c commit 240769c
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"./monoio/Cargo.toml"
]
}
2 changes: 1 addition & 1 deletion examples/timer_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async fn main() {
}
}

// A very improtant thing is if you use select to do timeout io,
// A very important thing is if you use select to do timeout io,
// you must cancel it manually.
// In epoll, dropping a read future has no side effect since we
// only wait for io ready, after waiting aborted, no syscall
Expand Down
2 changes: 1 addition & 1 deletion monoio-compat/src/tcp_unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl TcpStreamCompat {
///
/// # Safety
/// User must ensure that the data slice pointer and length is always
/// valid and the same among diffrent calls before Poll::Ready returns.
/// valid and the same among different calls before Poll::Ready returns.
pub unsafe fn new(stream: TcpStream) -> Self {
Self {
stream,
Expand Down
2 changes: 1 addition & 1 deletion monoio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ debug = ["tracing"]
legacy = ["mio"]
# iouring support
iouring = []
# tokio-compatiable(only have effect when legacy is enabled and iouring is not)
# tokio-compatible(only have effect when legacy is enabled and iouring is not)
tokio-compat = ["tokio"]
# signal enables setting ctrl_c handler
signal = ["ctrlc", "sync"]
Expand Down
4 changes: 2 additions & 2 deletions monoio/src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum JoinError {
}

/// BlockingTask is contrusted by monoio, ThreadPool impl
/// will exeucte it with `.run()`.
/// will execute it with `.run()`.
pub struct BlockingTask {
task: Option<crate::task::Task<NoopScheduler>>,
blocking_vtable: &'static BlockingTaskVtable,
Expand Down Expand Up @@ -118,7 +118,7 @@ where
join
}

/// DefaultThreadPool is a simple wrapped `threadpool::ThreadPool` that implememt
/// DefaultThreadPool is a simple wrapped `threadpool::ThreadPool` that implement
/// `monoio::blocking::ThreadPool`. You may use this implementation, or you can use your own thread
/// pool implementation.
#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/driver/op/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl OpAble for Accept {
let fd = self.fd.as_raw_fd();
let addr = self.addr.0.as_mut_ptr() as *mut _;
let len = &mut self.addr.1;
// Here I use copied some code from mio because I don't want the convertion.
// Here I use copied some code from mio because I don't want the conversion.

// On platforms that support it we can use `accept4(2)` to set `NONBLOCK`
// and `CLOEXEC` in the call to accept the connection.
Expand Down
10 changes: 5 additions & 5 deletions monoio/src/io/util/cancel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ pub struct CancelHandle {
}

/// Canceller is a user-hold struct to cancel io operations.
/// A canceller can assocate with multiple io operations.
/// A canceller can associate with multiple io operations.
#[derive(Default)]
pub struct Canceller {
shared: Rc<RefCell<Shared>>,
}

pub(crate) struct AssocateGuard {
pub(crate) struct AssociateGuard {
op_canceller: OpCanceller,
shared: Rc<RefCell<Shared>>,
}
Expand Down Expand Up @@ -67,19 +67,19 @@ impl CancelHandle {
self.shared.borrow().canceled
}

pub(crate) fn assocate_op(self, op_canceller: OpCanceller) -> AssocateGuard {
pub(crate) fn associate_op(self, op_canceller: OpCanceller) -> AssociateGuard {
{
let mut shared = self.shared.borrow_mut();
shared.slot_ref.insert(op_canceller.clone());
}
AssocateGuard {
AssociateGuard {
op_canceller,
shared: self.shared,
}
}
}

impl Drop for AssocateGuard {
impl Drop for AssociateGuard {
fn drop(&mut self) {
let mut shared = self.shared.borrow_mut();
shared.slot_ref.remove(&self.op_canceller);
Expand Down
12 changes: 6 additions & 6 deletions monoio/src/io/util/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ where
W: AsyncWriteRent + ?Sized,
{
let mut buf: Vec<u8> = Vec::with_capacity(BUF_SIZE);
let mut transfered: u64 = 0;
let mut transferred: u64 = 0;

'r: loop {
let (read_res, mut buf_read) = reader.read(buf).await;
Expand Down Expand Up @@ -60,15 +60,15 @@ where
}
Ok(n) => {
// go read data
transfered += n as u64;
transferred += n as u64;
buf = buf_;
break;
}
}
}
}

Ok(transfered)
Ok(transferred)
}

/// Copy with splice.
Expand All @@ -83,17 +83,17 @@ pub async fn zero_copy<SRC: crate::io::as_fd::AsReadFd, DST: crate::io::as_fd::A
};

let (mut pr, mut pw) = new_pipe()?;
let mut transfered: u64 = 0;
let mut transferred: u64 = 0;
loop {
let mut to_write = reader.splice_to_pipe(&mut pw, BUF_SIZE as u32).await?;
if to_write == 0 {
break;
}
transfered += to_write as u64;
transferred += to_write as u64;
while to_write > 0 {
let written = writer.splice_from_pipe(&mut pr, to_write).await?;
to_write -= written;
}
}
Ok(transfered)
Ok(transferred)
}
2 changes: 1 addition & 1 deletion monoio/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub(crate) fn new_socket(
#[cfg(unix)]
let socket = crate::syscall!(socket(domain, socket_type, 0));

// Mimick `libstd` and set `SO_NOSIGPIPE` on apple systems.
// Mimic `libstd` and set `SO_NOSIGPIPE` on apple systems.
#[cfg(target_vendor = "apple")]
let socket = socket.and_then(|socket| {
crate::syscall!(setsockopt(
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/net/tcp/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl TcpListener {
return Err(operation_canceled());
}
let op = Op::accept(&self.fd)?;
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());

// Await the completion of the event
let completion = op.await;
Expand Down
8 changes: 4 additions & 4 deletions monoio/src/net/tcp/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl CancelableAsyncWriteRent for TcpStream {
}

let op = Op::send(fd, buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.write().await
}
}
Expand All @@ -381,7 +381,7 @@ impl CancelableAsyncWriteRent for TcpStream {
}

let op = Op::writev(&fd, buf_vec).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.write().await
}
}
Expand Down Expand Up @@ -450,7 +450,7 @@ impl CancelableAsyncReadRent for TcpStream {
}

let op = Op::recv(fd, buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.read().await
}
}
Expand All @@ -468,7 +468,7 @@ impl CancelableAsyncReadRent for TcpStream {
}

let op = Op::readv(fd, buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.read().await
}
}
Expand Down
8 changes: 4 additions & 4 deletions monoio/src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl UdpSocket {
}

let op = Op::recv_msg(self.fd.clone(), buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.wait().await
}

Expand All @@ -227,7 +227,7 @@ impl UdpSocket {
}

let op = Op::send_msg(self.fd.clone(), buf, Some(socket_addr)).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.wait().await
}

Expand All @@ -242,7 +242,7 @@ impl UdpSocket {
}

let op = Op::send_msg(self.fd.clone(), buf, None).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.wait().await
}

Expand All @@ -258,7 +258,7 @@ impl UdpSocket {
}

let op = Op::recv(self.fd.clone(), buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.read().await
}
}
2 changes: 1 addition & 1 deletion monoio/src/net/unix/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl UnixListener {
return Err(operation_canceled());
}
let op = Op::accept(&self.fd)?;
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());

// Await the completion of the event
let completion = op.await;
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/net/unix/seq_packet/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{

const DEFAULT_BACKLOG: libc::c_int = 128;

/// Listner for UnixSeqpacket
/// Listener for UnixSeqpacket
pub struct UnixSeqpacketListener {
fd: SharedFd,
}
Expand Down
8 changes: 4 additions & 4 deletions monoio/src/net/unix/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl CancelableAsyncWriteRent for UnixStream {
}

let op = Op::send(fd, buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.write().await
}
}
Expand All @@ -252,7 +252,7 @@ impl CancelableAsyncWriteRent for UnixStream {
}

let op = Op::writev(&fd, buf_vec).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.write().await
}
}
Expand Down Expand Up @@ -316,7 +316,7 @@ impl CancelableAsyncReadRent for UnixStream {
}

let op = Op::recv(fd, buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.read().await
}
}
Expand All @@ -334,7 +334,7 @@ impl CancelableAsyncReadRent for UnixStream {
}

let op = Op::readv(fd, buf).unwrap();
let _guard = c.assocate_op(op.op_canceller());
let _guard = c.associate_op(op.op_canceller());
op.read().await
}
}
Expand Down
2 changes: 1 addition & 1 deletion monoio/src/utils/slab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl<T> Page<T> {
}

// alloc a slot
// Safety: after slot is allocated, the caller must guarante it will be
// Safety: after slot is allocated, the caller must guarantee it will be
// initialized
unsafe fn alloc(&mut self) -> Option<usize> {
let next = self.next;
Expand Down

0 comments on commit 240769c

Please sign in to comment.