1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-03-11 09:52:57 +01:00

attribute nits

This commit is contained in:
Rob Ede 2021-01-26 09:45:43 +00:00
parent eaefe21b98
commit cff9deb729
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
4 changed files with 15 additions and 15 deletions

View File

@ -50,20 +50,20 @@ impl<T: ResourcePath> Path<T> {
} }
} }
#[inline]
/// Get reference to inner path instance /// Get reference to inner path instance
#[inline]
pub fn get_ref(&self) -> &T { pub fn get_ref(&self) -> &T {
&self.path &self.path
} }
#[inline]
/// Get mutable reference to inner path instance /// Get mutable reference to inner path instance
#[inline]
pub fn get_mut(&mut self) -> &mut T { pub fn get_mut(&mut self) -> &mut T {
&mut self.path &mut self.path
} }
#[inline]
/// Path /// Path
#[inline]
pub fn path(&self) -> &str { pub fn path(&self) -> &str {
let skip = self.skip as usize; let skip = self.skip as usize;
let path = self.path.path(); let path = self.path.path();
@ -74,23 +74,23 @@ impl<T: ResourcePath> Path<T> {
} }
} }
#[inline]
/// Set new path /// Set new path
#[inline]
pub fn set(&mut self, path: T) { pub fn set(&mut self, path: T) {
self.skip = 0; self.skip = 0;
self.path = path; self.path = path;
self.segments.clear(); self.segments.clear();
} }
#[inline]
/// Reset state /// Reset state
#[inline]
pub fn reset(&mut self) { pub fn reset(&mut self) {
self.skip = 0; self.skip = 0;
self.segments.clear(); self.segments.clear();
} }
#[inline]
/// Skip first `n` chars in path /// Skip first `n` chars in path
#[inline]
pub fn skip(&mut self, n: u16) { pub fn skip(&mut self, n: u16) {
self.skip += n; self.skip += n;
} }
@ -109,14 +109,14 @@ impl<T: ResourcePath> Path<T> {
self.segments.push((name, PathItem::Static(value))); self.segments.push((name, PathItem::Static(value)));
} }
#[inline]
/// Check if there are any matched patterns /// Check if there are any matched patterns
#[inline]
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.segments.is_empty() self.segments.is_empty()
} }
#[inline]
/// Check number of extracted parameters /// Check number of extracted parameters
#[inline]
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.segments.len() self.segments.len()
} }

View File

@ -154,8 +154,8 @@ impl ResourceDef {
&self.pattern &self.pattern
} }
#[inline]
/// Check if path matches this pattern. /// Check if path matches this pattern.
#[inline]
pub fn is_match(&self, path: &str) -> bool { pub fn is_match(&self, path: &str) -> bool {
match self.tp { match self.tp {
PatternType::Static(ref s) => s == path, PatternType::Static(ref s) => s == path,

View File

@ -177,8 +177,8 @@ impl ServerBuilder {
Ok(self) Ok(self)
} }
#[cfg(unix)]
/// Add new unix domain service to the server. /// Add new unix domain service to the server.
#[cfg(unix)]
pub fn bind_uds<F, U, N>(self, name: N, addr: U, factory: F) -> io::Result<Self> pub fn bind_uds<F, U, N>(self, name: N, addr: U, factory: F) -> io::Result<Self>
where where
F: ServiceFactory<actix_rt::net::UnixStream>, F: ServiceFactory<actix_rt::net::UnixStream>,
@ -198,10 +198,10 @@ impl ServerBuilder {
self.listen_uds(name, lst, factory) self.listen_uds(name, lst, factory)
} }
#[cfg(unix)]
/// Add new unix domain service to the server. /// Add new unix domain service to the server.
/// Useful when running as a systemd service and /// Useful when running as a systemd service and
/// a socket FD can be acquired using the systemd crate. /// a socket FD can be acquired using the systemd crate.
#[cfg(unix)]
pub fn listen_uds<F, N: AsRef<str>>( pub fn listen_uds<F, N: AsRef<str>>(
mut self, mut self,
name: N, name: N,

View File

@ -40,16 +40,16 @@ impl LocalWaker {
since = "2.1.0", since = "2.1.0",
note = "In favor of `wake`. State of the register doesn't matter at `wake` up" note = "In favor of `wake`. State of the register doesn't matter at `wake` up"
)] )]
#[inline]
/// Check if waker has been registered. /// Check if waker has been registered.
#[inline]
pub fn is_registered(&self) -> bool { pub fn is_registered(&self) -> bool {
unsafe { (*self.waker.get()).is_some() } unsafe { (*self.waker.get()).is_some() }
} }
#[inline]
/// Registers the waker to be notified on calls to `wake`. /// Registers the waker to be notified on calls to `wake`.
/// ///
/// Returns `true` if waker was registered before. /// Returns `true` if waker was registered before.
#[inline]
pub fn register(&self, waker: &Waker) -> bool { pub fn register(&self, waker: &Waker) -> bool {
unsafe { unsafe {
let w = self.waker.get(); let w = self.waker.get();
@ -58,20 +58,20 @@ impl LocalWaker {
} }
} }
#[inline]
/// Calls `wake` on the last `Waker` passed to `register`. /// Calls `wake` on the last `Waker` passed to `register`.
/// ///
/// If `register` has not been called yet, then this does nothing. /// If `register` has not been called yet, then this does nothing.
#[inline]
pub fn wake(&self) { pub fn wake(&self) {
if let Some(waker) = self.take() { if let Some(waker) = self.take() {
waker.wake(); waker.wake();
} }
} }
#[inline]
/// Returns the last `Waker` passed to `register`, so that the user can wake it. /// Returns the last `Waker` passed to `register`, so that the user can wake it.
/// ///
/// If a waker has not been registered, this returns `None`. /// If a waker has not been registered, this returns `None`.
#[inline]
pub fn take(&self) -> Option<Waker> { pub fn take(&self) -> Option<Waker> {
unsafe { (*self.waker.get()).take() } unsafe { (*self.waker.get()).take() }
} }