JetStream

crates.io docs.rs Build Status Release Please🙏! benchmark pull requests crates.io downloads

JetStream is an RPC framework built on top of s2n-quic and p9. It's designed to be a high performance, low latency, secure, and reliable RPC framework.

Features:

You can see the crates for an overview of the crates in this repository.

📍🗺️ Distributed JetStream

Distributed JetStream is the crate that provides primitives for building distributed systems.

Currently we provide 4 primitives (with more to come).

TraitPurpose
ClusterA trait that provides membership semantics
PlacementA trait that provides placement semantics
CoordinateThis module provides an implementation of Vivaldi: A Decentralized Network Coordinate System) by Frank Dabek, Russ Cox, Frans Kaashoek, Robert Morris.
This implementation is based on the Go implementation by Hashicorp's Serf
access_controlThis module provides Accesss Control Semantics that align with Google's Zanzibar

Changelog

8.0.8 (2025-02-01)

Bug Fixes

8.0.7 (2025-01-30)

Bug Fixes

8.0.6 (2025-01-30)

Bug Fixes

8.0.5 (2025-01-30)

Bug Fixes

  • use cargo publish workspace (e28a0f7)

8.0.4 (2025-01-30)

Bug Fixes

8.0.3 (2025-01-30)

Bug Fixes

8.0.2 (2025-01-30)

Bug Fixes

  • criterion benchmark test, framed implementation (25b1611)
  • failing serde tests (81db0de)
  • reenable sccache (757bb7e)
  • service macro works correctly with client calls (eb1fd0f)
  • snapshots for macros (fab686d)

8.0.1 (2025-01-28)

Bug Fixes

8.0.0 (2025-01-27)

⚠ BREAKING CHANGES

  • use more futures

Features

Bug Fixes

7.4.0 (2025-01-18)

Features

  • jetstream_rpc supports wasm (e97e6ca)

7.3.0 (2025-01-17)

Features

7.2.1 (2024-12-10)

Bug Fixes

  • keep reciver types as is in generated code (7d95671)

7.2.0 (2024-12-09)

Features

7.1.2 (2024-12-06)

Bug Fixes

7.1.1 (2024-11-25)

Bug Fixes

  • broken use statement for async_trait (cce4df6)

7.1.0 (2024-11-25)

Features

  • added async_trait support service macro (9a86185)

7.0.4 (2024-11-23)

Bug Fixes

7.0.3 (2024-11-21)

Bug Fixes

7.0.1 (2024-11-21)

Bug Fixes

7.0.0 (2024-11-21)

⚠ BREAKING CHANGES

  • fix proken publish

Features

6.6.2 (2024-11-21)

Bug Fixes

6.6.1 (2024-11-20)

Bug Fixes

6.6.0 (2024-11-20)

Features

  • distributes jetsream (d1477d5)
  • jetstream_distributed: placement (8a93788)

Bug Fixes

6.5.0 (2024-11-20)

Features

Bug Fixes

6.4.2 (2024-11-18)

Bug Fixes

6.4.1 (2024-11-11)

Bug Fixes

  • make the proto mod same vis as trait (a43c0a2)

6.4.0 (2024-11-10)

Features

  • Add support for bool in WireFormat (640c6ca)
  • Add tests for jetstream modules (18462d9)

Bug Fixes

6.3.4 (2024-11-10)

Bug Fixes

6.3.3 (2024-11-10)

Bug Fixes

  • update 9p to use trait_variant (96db410)

6.3.2 (2024-11-10)

Bug Fixes

6.3.1 (2024-11-09)

Bug Fixes

6.3.0 (2024-11-09)

Features

Bug Fixes

6.2.0 (2024-11-08)

Features

  • add i16,i32,i64,i128 types (3f0751a)

6.1.0 (2024-11-08)

Features

6.0.2 (2024-11-08)

Bug Fixes

6.0.1 (2024-11-08)

Bug Fixes

6.0.0 (2024-11-07)

⚠ BREAKING CHANGES

  • splits up packages
  • move modules to sensible parents
  • protocol -> coding
  • merge all the creates

Features

Bug Fixes

Code Refactoring

  • merge all the creates (faa0a1a)
  • move modules to sensible parents (4eba5fb)
  • protocol -> coding (5f86bc7)

5.4.2 (2024-11-07)

Bug Fixes

5.4.2 (2024-11-07)

Bug Fixes

5.4.1 (2024-11-07)

Bug Fixes

5.4.0 (2024-11-07)

Features

5.3.0 (2024-10-23)

Features

Bug Fixes

5.2.3 (2024-10-10)

Bug Fixes

5.2.2 (2024-10-07)

Bug Fixes

  • revert serde_bytes to bytes with serde (2e02460)

5.2.1 (2024-10-06)

Bug Fixes

  • wireformat: from_bytes doesn't require a mutable buf (437c35c)

5.2.0 (2024-10-06)

Features

  • use serde_bytes::ByteBuf instead of Bytes (a1101d9)

Bug Fixes

5.1.4 (2024-10-03)

Bug Fixes

5.1.3 (2024-10-03)

Bug Fixes

5.1.2 (2024-10-03)

Bug Fixes

5.1.1 (2024-10-03)

Bug Fixes

5.1.0 (2024-10-03)

Features

Bug Fixes

5.0.0 (2024-10-03)

⚠ BREAKING CHANGES

  • splits up packages

Features

Bug Fixes

4.0.0 (2024-10-01)

⚠ BREAKING CHANGES

  • move modules to sensible parents

Code Refactoring

  • move modules to sensible parents (4eba5fb)

3.0.0 (2024-03-30)

⚠ BREAKING CHANGES

  • protocol -> coding
  • merge all the creates

Features

Bug Fixes

Code Refactoring

2.0.2 (2024-03-30)

Bug Fixes

2.0.1 (2024-03-29)

Bug Fixes

  • macros: protocol macro fix to spread fn args (b261a28)

2.0.0 (2024-03-29)

⚠ BREAKING CHANGES

  • protocol -> coding

Code Refactoring

1.1.1 (2024-03-29)

Bug Fixes

1.1.0 (2024-03-29)

Features

  • macros: service macro to remove boilerplate code (e0a9295)

1.0.0 (2024-03-25)

⚠ BREAKING CHANGES

  • merge all the creates

Code Refactoring

0.6.0 (2024-03-21)

Features

0.5.1 (2024-03-15)

Bug Fixes

  • filesystem under feature flag, rm newline (de4cf79)
  • Update client_tests.rs (4c50132)

0.5.0 (2024-03-15)

Features

  • rust-clippy code scanning (3dfb39f)

Bug Fixes

  • update to v2 upload sarif (e38bacb)

0.4.0 (2024-03-14)

Features

0.3.2 (2024-03-14)

Bug Fixes

0.3.1 (2024-03-14)

Bug Fixes

0.3.0 (2024-03-14)

Features

0.2.0 (2024-03-14)

Features

Coverage

🦀 Crates

Crate jetstream

JetStream

JetStream, is a collection of crates that provide a set of tools to build distributed systems. It started it’s life off in the CrosVM project, and has since been extracted into it’s own project. For more information please see the JetStream Book

Modules

jetstream

Module prelude

Re-exports

  • pub use trait_variant;:

Modules

Macros

  • lazy_``static:

Structs

  • Data: A type that encodes an arbitrary number of bytes of data. Typically used for Rread Twrite messages. This differs from a Vec<u8> in that it encodes the number of bytes using a u32 instead of a u16.
  • Frame:
  • Tag:

Enums

Traits

  • Client``Transport:
  • Framer:
  • Lazy``Static: Support trait for enabling a few common operation on lazy static values.
  • Message: A trait representing a message that can be encoded and decoded.
  • Protocol: Defines the request and response types for the JetStream protocol.
  • Service``Transport:
  • Wire``Format: A type that can be encoded on the wire using the 9P protocol.
  • __Deref: Used for immutable dereferencing operations, like *v.

Functions

  • initialize: Takes a shared reference to a lazy static and initializes it if it has not been already.

Attribute Macros

  • async_``trait:
  • service: Service attribute macro for creating RPC services

Derive Macros

  • JetStream``Wire``Format: Derives wire format encoding for structs

jetstream::prelude

Attribute Macro async_trait

#[async_trait]

jetstream::prelude

Attribute Macro service

#[service]

Service attribute macro for creating RPC services

jetstream::prelude

Module client

Structs

  • Client``Codec:

jetstream::prelude::client

Struct ClientCodec

pub struct ClientCodec<P>where
    P: Protocol,{ /* private fields */ }

Trait Implementations

impl

Decoder for ClientCodec

where P: Protocol,

type Error = Error

The type of unrecoverable frame decoding errors. Read more

type Item = Frame<

::Response>

The type of decoded frames.

fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<<ClientCodec

as Decoder>::Item>, <ClientCodec

as Decoder>::Error>

Attempts to decode a frame from the provided buffer of bytes. Read more

fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more

fn framed(self, io: T) -> Framed<T, Self>where T: AsyncRead + AsyncWrite, Self: Sized,

Provides a Stream and Sink interface for reading and writing to thisIo object, using Decode and Encode to read and write the raw data. Read more

impl

Default for ClientCodec

where P: Protocol,

fn default() -> ClientCodec

Returns the “default value” for a type. Read more

impl

Encoder<Frame<

::Request>> for ClientCodec

where P: Protocol,

type Error = Error

The type of encoding errors. Read more

fn encode( &mut self, item: Frame<

::Request>, dst: &mut BytesMut, ) -> Result<(), <ClientCodec

as Encoder<Frame<

::Request>>>::Error>

Encodes a frame into the buffer provided. Read more

Auto Trait Implementations

impl

Freeze for ClientCodec

impl

RefUnwindSafe for ClientCodec

where P: RefUnwindSafe,

impl

Send for ClientCodec

impl

Sync for ClientCodec

impl

Unpin for ClientCodec

where P: Unpin,

impl

UnwindSafe for ClientCodec

where P: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude

Derive Macro JetStreamWireFormat

#[derive(JetStreamWireFormat)]

Derives wire format encoding for structs

jetstream::prelude

Enum Error

pub enum Error {
    Io(Error),
    Generic(Box<dyn Error + Send + Sync>),
    Custom(String),
    InvalidResponse,
}

Variants

Io(Error)

Generic(Box<dyn Error + Send + Sync>)

Custom(String)

InvalidResponse

Trait Implementations

impl Debug for Error

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl Display for Error

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl Error for Error

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more1.0.0 ·

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string() Read more1.0.0 ·

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type-based access to context intended for error reports. Read more

impl From<Box<dyn Error + Send + Sync>> for Error

fn from(source: Box<dyn Error + Send + Sync>) -> Error

Converts to this type from the input type.

impl From for Error

fn from(source: Error) -> Error

Converts to this type from the input type.

Auto Trait Implementations

impl Freeze for Error

impl !RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl ToString for Twhere T: Display + ?Sized,

default fn to_string(&self) -> String

Converts the given value to a String. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude

Function initialize

pub fn initialize<T>(lazy: &T)where
    T: LazyStatic,

Takes a shared reference to a lazy static and initializes it if it has not been already.

This can be used to control the initialization point of a lazy static.

Example:

use lazy_static::lazy_static;

lazy_static! {
    static ref BUFFER: Vec<u8> = (0..255).collect();
}

fn main() {
    lazy_static::initialize(&BUFFER);

    // ...
    work_with_initialized_data(&BUFFER);
}

jetstream::prelude

Macro lazy_static

macro_rules! lazy_static {
    ($(#[$attr:meta])* static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { ... };
    ($(#[$attr:meta])* pub static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { ... };
    ($(#[$attr:meta])* pub ($($vis:tt)+) static ref $N:ident : $T:ty = $e:expr; $($t:tt)*) => { ... };
    () => { ... };
}

jetstream::prelude

Module p9

Modules

Structs

Enums

  • Rmessage: A message sent from a 9P server to a 9P client in response to a request from that client. Encapsulates a full frame.
  • Tmessage: A message sent from a 9P client to a 9P server.
  • Version:

Constants

  • DEFAULT_``MSIZE:
  • MAPPED_``FLAGS:
  • MAX_``MESSAGE_``SIZE:
  • MIN_``MESSAGE_``SIZE:
  • P9_``APPEND:
  • P9_``CREATE:
  • P9_``DIRECT:
  • P9_``DIRECTORY:
  • P9_``DSYNC:
  • P9_EXCL:
  • P9_``FASYNC:
  • P9_``GETATTR_``BASIC:
  • P9_``LARGEFILE:
  • P9_``LOCK_``SUCCESS:
  • P9_``LOCK_``TYPE_``UNLCK:
  • P9_``NOACCESS:
  • P9_``NOATIME:
  • P9_``NOCTTY:
  • P9_``NOFOLLOW:
  • P9_``NONBLOCK:
  • P9_``QTDIR:
  • P9_``QTFILE:
  • P9_``QTSYMLINK:
  • P9_``RDONLY:
  • P9_RDWR:
  • P9_``SETATTR_``ATIME:
  • P9_``SETATTR_``ATIME_``SET:
  • P9_``SETATTR_``CTIME:
  • P9_``SETATTR_``GID:
  • P9_``SETATTR_``MODE:
  • P9_``SETATTR_``MTIME:
  • P9_``SETATTR_``MTIME_``SET:
  • P9_``SETATTR_``SIZE:
  • P9_``SETATTR_``UID:
  • P9_SYNC:
  • P9_``TRUNC:
  • P9_``WRONLY:
  • _P9_``CLOEXEC:
  • _P9_``GETATTR_``ALL:
  • _P9_``GETATTR_``ATIME:
  • _P9_``GETATTR_``BLOCKS:
  • _P9_``GETATTR_``BTIME:
  • _P9_``GETATTR_``CTIME:
  • _P9_``GETATTR_``DATA_``VERSION:
  • _P9_``GETATTR_``GEN:
  • _P9_``GETATTR_``GID:
  • _P9_``GETATTR_``INO:
  • _P9_``GETATTR_``MODE:
  • _P9_``GETATTR_``MTIME:
  • _P9_``GETATTR_``NLINK:
  • _P9_``GETATTR_``RDEV:
  • _P9_``GETATTR_``SIZE:
  • _P9_``GETATTR_``UID:
  • _P9_``LOCK_``BLOCKED:
  • _P9_``LOCK_``ERROR:
  • _P9_``LOCK_``FLAGS_``BLOCK:
  • _P9_``LOCK_``FLAGS_``RECLAIM:
  • _P9_``LOCK_``GRACE:
  • _P9_``LOCK_``TYPE_``RDLCK:
  • _P9_``LOCK_``TYPE_``WRLCK:
  • _P9_``QTAPPEND:
  • _P9_``QTAUTH:
  • _P9_``QTEXCL:
  • _P9_``QTLINK:
  • _P9_``QTMOUNT:
  • _P9_``QTTMP:

Functions

  • error_``to_``rmessage:

jetstream::prelude::p9

Constant DEFAULT_MSIZE

pub const DEFAULT_MSIZE: u32 = 8192; // 8_192u32

jetstream::prelude::p9

Constant MAPPED_FLAGS

pub const MAPPED_FLAGS: [(u32, i32); 16];

jetstream::prelude::p9

Constant MAX_MESSAGE_SIZE

pub const MAX_MESSAGE_SIZE: u32 = _; // 65_560u32

jetstream::prelude::p9

Constant MIN_MESSAGE_SIZE

pub const MIN_MESSAGE_SIZE: u32 = 256; // 256u32

jetstream::prelude::p9

Constant P9_APPEND

pub const P9_APPEND: u32 = 0o00002000; // 1_024u32

jetstream::prelude::p9

Constant P9_CREATE

pub const P9_CREATE: u32 = 0o00000100; // 64u32

jetstream::prelude::p9

Constant P9_DIRECT

pub const P9_DIRECT: u32 = 0o00040000; // 16_384u32

jetstream::prelude::p9

Constant P9_DIRECTORY

pub const P9_DIRECTORY: u32 = 0o00200000; // 65_536u32

jetstream::prelude::p9

Constant P9_DSYNC

pub const P9_DSYNC: u32 = 0o00010000; // 4_096u32

jetstream::prelude::p9

Constant P9_EXCL

pub const P9_EXCL: u32 = 0o00000200; // 128u32

jetstream::prelude::p9

Constant P9_FASYNC

pub const P9_FASYNC: u32 = 0o00020000; // 8_192u32

jetstream::prelude::p9

Constant P9_GETATTR_BASIC

pub const P9_GETATTR_BASIC: u64 = 0x000007ff; // 2_047u64

jetstream::prelude::p9

Constant P9_LARGEFILE

pub const P9_LARGEFILE: u32 = 0o00100000; // 32_768u32

jetstream::prelude::p9

Constant P9_LOCK_SUCCESS

pub const P9_LOCK_SUCCESS: u8 = 0; // 0u8

jetstream::prelude::p9

Constant P9_LOCK_TYPE_UNLCK

pub const P9_LOCK_TYPE_UNLCK: u8 = 2; // 2u8

jetstream::prelude::p9

Constant P9_NOACCESS

pub const P9_NOACCESS: u32 = 0o00000003; // 3u32

jetstream::prelude::p9

Constant P9_NOATIME

pub const P9_NOATIME: u32 = 0o01000000; // 262_144u32

jetstream::prelude::p9

Constant P9_NOCTTY

pub const P9_NOCTTY: u32 = 0o00000400; // 256u32

jetstream::prelude::p9

Constant P9_NOFOLLOW

pub const P9_NOFOLLOW: u32 = 0o00400000; // 131_072u32

jetstream::prelude::p9

Constant P9_NONBLOCK

pub const P9_NONBLOCK: u32 = 0o00004000; // 2_048u32

jetstream::prelude::p9

Constant P9_QTDIR

pub const P9_QTDIR: u8 = 0x80; // 128u8

jetstream::prelude::p9

Constant P9_QTFILE

pub const P9_QTFILE: u8 = 0x00; // 0u8

jetstream::prelude::p9

Constant P9_QTSYMLINK

pub const P9_QTSYMLINK: u8 = 0x02; // 2u8

jetstream::prelude::p9

Constant P9_RDONLY

pub const P9_RDONLY: u32 = 0o00000000; // 0u32

jetstream::prelude::p9

Constant P9_RDWR

pub const P9_RDWR: u32 = 0o00000002; // 2u32

jetstream::prelude::p9

Constant P9_SETATTR_ATIME

pub const P9_SETATTR_ATIME: u32 = 0x00000010; // 16u32

jetstream::prelude::p9

Constant P9_SETATTR_ATIME_SET

pub const P9_SETATTR_ATIME_SET: u32 = 0x00000080; // 128u32

jetstream::prelude::p9

Constant P9_SETATTR_CTIME

pub const P9_SETATTR_CTIME: u32 = 0x00000040; // 64u32

jetstream::prelude::p9

Constant P9_SETATTR_GID

pub const P9_SETATTR_GID: u32 = 0x00000004; // 4u32

jetstream::prelude::p9

Constant P9_SETATTR_MODE

pub const P9_SETATTR_MODE: u32 = 0x00000001; // 1u32

jetstream::prelude::p9

Constant P9_SETATTR_MTIME

pub const P9_SETATTR_MTIME: u32 = 0x00000020; // 32u32

jetstream::prelude::p9

Constant P9_SETATTR_MTIME_SET

pub const P9_SETATTR_MTIME_SET: u32 = 0x00000100; // 256u32

jetstream::prelude::p9

Constant P9_SETATTR_SIZE

pub const P9_SETATTR_SIZE: u32 = 0x00000008; // 8u32

jetstream::prelude::p9

Constant P9_SETATTR_UID

pub const P9_SETATTR_UID: u32 = 0x00000002; // 2u32

jetstream::prelude::p9

Constant P9_SYNC

pub const P9_SYNC: u32 = 0o04000000; // 1_048_576u32

jetstream::prelude::p9

Constant P9_TRUNC

pub const P9_TRUNC: u32 = 0o00001000; // 512u32

jetstream::prelude::p9

Constant P9_WRONLY

pub const P9_WRONLY: u32 = 0o00000001; // 1u32

jetstream::prelude::p9

Constant _P9_CLOEXEC

pub const _P9_CLOEXEC: u32 = 0o02000000; // 524_288u32

jetstream::prelude::p9

Constant _P9_GETATTR_ALL

pub const _P9_GETATTR_ALL: u64 = 0x00003fff; // 16_383u64

jetstream::prelude::p9

Constant _P9_GETATTR_ATIME

pub const _P9_GETATTR_ATIME: u64 = 0x00000020; // 32u64

jetstream::prelude::p9

Constant _P9_GETATTR_BLOCKS

pub const _P9_GETATTR_BLOCKS: u64 = 0x00000400; // 1_024u64

jetstream::prelude::p9

Constant _P9_GETATTR_BTIME

pub const _P9_GETATTR_BTIME: u64 = 0x00000800; // 2_048u64

jetstream::prelude::p9

Constant _P9_GETATTR_CTIME

pub const _P9_GETATTR_CTIME: u64 = 0x00000080; // 128u64

jetstream::prelude::p9

Constant _P9_GETATTR_DATA_VERSION

pub const _P9_GETATTR_DATA_VERSION: u64 = 0x00002000; // 8_192u64

jetstream::prelude::p9

Constant _P9_GETATTR_GEN

pub const _P9_GETATTR_GEN: u64 = 0x00001000; // 4_096u64

jetstream::prelude::p9

Constant _P9_GETATTR_GID

pub const _P9_GETATTR_GID: u64 = 0x00000008; // 8u64

jetstream::prelude::p9

Constant _P9_GETATTR_INO

pub const _P9_GETATTR_INO: u64 = 0x00000100; // 256u64

jetstream::prelude::p9

Constant _P9_GETATTR_MODE

pub const _P9_GETATTR_MODE: u64 = 0x00000001; // 1u64

jetstream::prelude::p9

Constant _P9_GETATTR_MTIME

pub const _P9_GETATTR_MTIME: u64 = 0x00000040; // 64u64

jetstream::prelude::p9

Constant _P9_GETATTR_NLINK

pub const _P9_GETATTR_NLINK: u64 = 0x00000002; // 2u64

jetstream::prelude::p9

Constant _P9_GETATTR_RDEV

pub const _P9_GETATTR_RDEV: u64 = 0x00000010; // 16u64

jetstream::prelude::p9

Constant _P9_GETATTR_SIZE

pub const _P9_GETATTR_SIZE: u64 = 0x00000200; // 512u64

jetstream::prelude::p9

Constant _P9_GETATTR_UID

pub const _P9_GETATTR_UID: u64 = 0x00000004; // 4u64

jetstream::prelude::p9

Constant _P9_LOCK_BLOCKED

pub const _P9_LOCK_BLOCKED: u8 = 1; // 1u8

jetstream::prelude::p9

Constant _P9_LOCK_ERROR

pub const _P9_LOCK_ERROR: u8 = 2; // 2u8

jetstream::prelude::p9

Constant _P9_LOCK_FLAGS_BLOCK

pub const _P9_LOCK_FLAGS_BLOCK: u8 = 1; // 1u8

jetstream::prelude::p9

Constant _P9_LOCK_FLAGS_RECLAIM

pub const _P9_LOCK_FLAGS_RECLAIM: u8 = 2; // 2u8

jetstream::prelude::p9

Constant _P9_LOCK_GRACE

pub const _P9_LOCK_GRACE: u8 = 3; // 3u8

jetstream::prelude::p9

Constant _P9_LOCK_TYPE_RDLCK

pub const _P9_LOCK_TYPE_RDLCK: u8 = 0; // 0u8

jetstream::prelude::p9

Constant _P9_LOCK_TYPE_WRLCK

pub const _P9_LOCK_TYPE_WRLCK: u8 = 1; // 1u8

jetstream::prelude::p9

Constant _P9_QTAPPEND

pub const _P9_QTAPPEND: u8 = 0x40; // 64u8

jetstream::prelude::p9

Constant _P9_QTAUTH

pub const _P9_QTAUTH: u8 = 0x08; // 8u8

jetstream::prelude::p9

Constant _P9_QTEXCL

pub const _P9_QTEXCL: u8 = 0x20; // 32u8

jetstream::prelude::p9

Constant _P9_QTLINK

pub const _P9_QTLINK: u8 = 0x01; // 1u8

jetstream::prelude::p9

Constant _P9_QTMOUNT

pub const _P9_QTMOUNT: u8 = 0x10; // 16u8

jetstream::prelude::p9

Constant _P9_QTTMP

pub const _P9_QTTMP: u8 = 0x04; // 4u8

jetstream::prelude::p9

Enum Rmessage

pub enum Rmessage {
    Version(Rversion),
    Flush,
    Walk(Rwalk),
    Read(Rread),
    Write(Rwrite),
    Clunk,
    Remove,
    Attach(Rattach),
    Auth(Rauth),
    Statfs(Rstatfs),
    Lopen(Rlopen),
    Lcreate(Rlcreate),
    Symlink(Rsymlink),
    Mknod(Rmknod),
    Rename,
    Readlink(Rreadlink),
    GetAttr(Rgetattr),
    SetAttr,
    XattrWalk(Rxattrwalk),
    XattrCreate,
    Readdir(Rreaddir),
    Fsync,
    Lock(Rlock),
    GetLock(Rgetlock),
    Link,
    Mkdir(Rmkdir),
    RenameAt,
    UnlinkAt,
    Lerror(Rlerror),
}

A message sent from a 9P server to a 9P client in response to a request from that client. Encapsulates a full frame.

Variants

Version(Rversion)

Flush

Walk(Rwalk)

Read(Rread)

Write(Rwrite)

Clunk

Remove

Attach(Rattach)

Auth(Rauth)

Statfs(Rstatfs)

Lopen(Rlopen)

Lcreate(Rlcreate)

Mknod(Rmknod)

Rename

GetAttr(Rgetattr)

SetAttr

XattrWalk(Rxattrwalk)

XattrCreate

Readdir(Rreaddir)

Fsync

Lock(Rlock)

GetLock(Rgetlock)

Mkdir(Rmkdir)

RenameAt

UnlinkAt

Lerror(Rlerror)

Trait Implementations

impl Debug for Rmessage

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Freeze for Rmessage

impl RefUnwindSafe for Rmessage

impl Send for Rmessage

impl Sync for Rmessage

impl Unpin for Rmessage

impl UnwindSafe for Rmessage

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Enum Tmessage

#[repr(u8)]pub enum Tmessage {
    Version(Tversion),
    Flush(Tflush),
    Walk(Twalk),
    Read(Tread),
    Write(Twrite),
    Clunk(Tclunk),
    Remove(Tremove),
    Attach(Tattach),
    Auth(Tauth),
    Statfs(Tstatfs),
    Lopen(Tlopen),
    Lcreate(Tlcreate),
    Symlink(Tsymlink),
    Mknod(Tmknod),
    Rename(Trename),
    Readlink(Treadlink),
    GetAttr(Tgetattr),
    SetAttr(Tsetattr),
    XattrWalk(Txattrwalk),
    XattrCreate(Txattrcreate),
    Readdir(Treaddir),
    Fsync(Tfsync),
    Lock(Tlock),
    GetLock(Tgetlock),
    Link(Tlink),
    Mkdir(Tmkdir),
    RenameAt(Trenameat),
    UnlinkAt(Tunlinkat),
}

A message sent from a 9P client to a 9P server.

Variants

Version(Tversion)

Flush(Tflush)

Walk(Twalk)

Read(Tread)

Write(Twrite)

Clunk(Tclunk)

Remove(Tremove)

Attach(Tattach)

Auth(Tauth)

Statfs(Tstatfs)

Lopen(Tlopen)

Lcreate(Tlcreate)

Mknod(Tmknod)

Rename(Trename)

GetAttr(Tgetattr)

SetAttr(Tsetattr)

XattrWalk(Txattrwalk)

XattrCreate(Txattrcreate)

Readdir(Treaddir)

Fsync(Tfsync)

Lock(Tlock)

GetLock(Tgetlock)

Mkdir(Tmkdir)

RenameAt(Trenameat)

UnlinkAt(Tunlinkat)

Trait Implementations

impl Debug for Tmessage

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Freeze for Tmessage

impl RefUnwindSafe for Tmessage

impl Send for Tmessage

impl Sync for Tmessage

impl Unpin for Tmessage

impl UnwindSafe for Tmessage

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Enum Version

pub enum Version {
    V9P2000 = 0,
    V9P2000U = 1,
    V9P2000L = 2,
    V9P2000Lu = 3,
    V9P2024q9p = 4,
}

Variants

V9P2000 = 0

V9P2000U = 1

V9P2000L = 2

V9P2000Lu = 3

V9P2024q9p = 4

Trait Implementations

impl From<&str> for Version

fn from(version: &str) -> Version

Converts to this type from the input type.

impl From for Version

fn from(version: String) -> Version

Converts to this type from the input type.

impl From for &str

fn from(val: Version) -> &str

Converts to this type from the input type.

Auto Trait Implementations

impl Freeze for Version

impl RefUnwindSafe for Version

impl Send for Version

impl Sync for Version

impl Unpin for Version

impl UnwindSafe for Version

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Function error_to_rmessage

pub fn error_to_rmessage(err: &Error) -> Rlerror

jetstream::prelude::p9

Module messages

Structs

Enums

  • Rmessage: A message sent from a 9P server to a 9P client in response to a request from that client. Encapsulates a full frame.
  • Tmessage: A message sent from a 9P client to a 9P server.

jetstream::prelude::p9::messages

Enum Rmessage

pub enum Rmessage {
    Version(Rversion),
    Flush,
    Walk(Rwalk),
    Read(Rread),
    Write(Rwrite),
    Clunk,
    Remove,
    Attach(Rattach),
    Auth(Rauth),
    Statfs(Rstatfs),
    Lopen(Rlopen),
    Lcreate(Rlcreate),
    Symlink(Rsymlink),
    Mknod(Rmknod),
    Rename,
    Readlink(Rreadlink),
    GetAttr(Rgetattr),
    SetAttr,
    XattrWalk(Rxattrwalk),
    XattrCreate,
    Readdir(Rreaddir),
    Fsync,
    Lock(Rlock),
    GetLock(Rgetlock),
    Link,
    Mkdir(Rmkdir),
    RenameAt,
    UnlinkAt,
    Lerror(Rlerror),
}

A message sent from a 9P server to a 9P client in response to a request from that client. Encapsulates a full frame.

Variants

Version(Rversion)

Flush

Walk(Rwalk)

Read(Rread)

Write(Rwrite)

Clunk

Remove

Attach(Rattach)

Auth(Rauth)

Statfs(Rstatfs)

Lopen(Rlopen)

Lcreate(Rlcreate)

Mknod(Rmknod)

Rename

GetAttr(Rgetattr)

SetAttr

XattrWalk(Rxattrwalk)

XattrCreate

Readdir(Rreaddir)

Fsync

Lock(Rlock)

GetLock(Rgetlock)

Mkdir(Rmkdir)

RenameAt

UnlinkAt

Lerror(Rlerror)

Trait Implementations

impl Debug for Rmessage

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Freeze for Rmessage

impl RefUnwindSafe for Rmessage

impl Send for Rmessage

impl Sync for Rmessage

impl Unpin for Rmessage

impl UnwindSafe for Rmessage

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Enum Tmessage

#[repr(u8)]pub enum Tmessage {
    Version(Tversion),
    Flush(Tflush),
    Walk(Twalk),
    Read(Tread),
    Write(Twrite),
    Clunk(Tclunk),
    Remove(Tremove),
    Attach(Tattach),
    Auth(Tauth),
    Statfs(Tstatfs),
    Lopen(Tlopen),
    Lcreate(Tlcreate),
    Symlink(Tsymlink),
    Mknod(Tmknod),
    Rename(Trename),
    Readlink(Treadlink),
    GetAttr(Tgetattr),
    SetAttr(Tsetattr),
    XattrWalk(Txattrwalk),
    XattrCreate(Txattrcreate),
    Readdir(Treaddir),
    Fsync(Tfsync),
    Lock(Tlock),
    GetLock(Tgetlock),
    Link(Tlink),
    Mkdir(Tmkdir),
    RenameAt(Trenameat),
    UnlinkAt(Tunlinkat),
}

A message sent from a 9P client to a 9P server.

Variants

Version(Tversion)

Flush(Tflush)

Walk(Twalk)

Read(Tread)

Write(Twrite)

Clunk(Tclunk)

Remove(Tremove)

Attach(Tattach)

Auth(Tauth)

Statfs(Tstatfs)

Lopen(Tlopen)

Lcreate(Tlcreate)

Mknod(Tmknod)

Rename(Trename)

GetAttr(Tgetattr)

SetAttr(Tsetattr)

XattrWalk(Txattrwalk)

XattrCreate(Txattrcreate)

Readdir(Treaddir)

Fsync(Tfsync)

Lock(Tlock)

GetLock(Tgetlock)

Mkdir(Tmkdir)

RenameAt(Trenameat)

UnlinkAt(Tunlinkat)

Trait Implementations

impl Debug for Tmessage

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Freeze for Tmessage

impl RefUnwindSafe for Tmessage

impl Send for Tmessage

impl Sync for Tmessage

impl Unpin for Tmessage

impl UnwindSafe for Tmessage

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Dirent

pub struct Dirent {
    pub qid: Qid,
    pub offset: u64,
    pub ty: u8,
    pub name: String,
}

Dirent – directory entry

Fields

qid: Qid``offset: u64``ty: u8``name: String

Trait Implementations

impl Debug for Dirent

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Dirent

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Dirent, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Dirent

impl RefUnwindSafe for Dirent

impl Send for Dirent

impl Sync for Dirent

impl Unpin for Dirent

impl UnwindSafe for Dirent

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Qid

pub struct Qid {
    pub ty: u8,
    pub version: u32,
    pub path: u64,
}

Qid

Fields

ty: u8``version: u32``path: u64

Trait Implementations

impl Clone for Qid

fn clone(&self) -> Qid

Returns a copy of the value. Read more1.0.0 ·

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for Qid

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl From for Qid

fn from(st: stat64) -> Qid

Converts to this type from the input type.

impl Hash for Qid

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more1.3.0 ·

fn hash_slice(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq for Qid

fn eq(&self, other: &Qid) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl WireFormat for Qid

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Qid, Error>where R: Read,

Decodes Self from reader.

impl Copy for Qid

impl Eq for Qid

impl StructuralPartialEq for Qid

Auto Trait Implementations

impl Freeze for Qid

impl RefUnwindSafe for Qid

impl Send for Qid

impl Sync for Qid

impl Unpin for Qid

impl UnwindSafe for Qid

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl CloneToUninit for Twhere T: Clone,

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)Performs copy-assignment from self to dst. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl ToOwned for Twhere T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rattach

pub struct Rattach {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rattach

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rattach

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rattach, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rattach

impl RefUnwindSafe for Rattach

impl Send for Rattach

impl Sync for Rattach

impl Unpin for Rattach

impl UnwindSafe for Rattach

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rauth

pub struct Rauth {
    pub aqid: Qid,
}

Fields

aqid: Qid

Trait Implementations

impl Debug for Rauth

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rauth

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rauth, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rauth

impl RefUnwindSafe for Rauth

impl Send for Rauth

impl Sync for Rauth

impl Unpin for Rauth

impl UnwindSafe for Rauth

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rerror

pub struct Rerror {
    pub ename: String,
}

Fields

ename: String

Trait Implementations

impl Debug for Rerror

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rerror

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rerror, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rerror

impl RefUnwindSafe for Rerror

impl Send for Rerror

impl Sync for Rerror

impl Unpin for Rerror

impl UnwindSafe for Rerror

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rframe

pub struct Rframe {
    pub tag: u16,
    pub msg: Rmessage,
}

Fields

tag: u16``msg: Rmessage

Trait Implementations

impl Debug for Rframe

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rframe

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Rframe, Error>where R: Read,

Decodes Self from reader.

impl Message for Rframe

Auto Trait Implementations

impl Freeze for Rframe

impl RefUnwindSafe for Rframe

impl Send for Rframe

impl Sync for Rframe

impl Unpin for Rframe

impl UnwindSafe for Rframe

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rgetattr

pub struct Rgetattr {
    pub valid: u64,
    pub qid: Qid,
    pub mode: u32,
    pub uid: u32,
    pub gid: u32,
    pub nlink: u64,
    pub rdev: u64,
    pub size: u64,
    pub blksize: u64,
    pub blocks: u64,
    pub atime_sec: u64,
    pub atime_nsec: u64,
    pub mtime_sec: u64,
    pub mtime_nsec: u64,
    pub ctime_sec: u64,
    pub ctime_nsec: u64,
    pub btime_sec: u64,
    pub btime_nsec: u64,
    pub gen: u64,
    pub data_version: u64,
}

Fields

valid: u64``qid: Qid``mode: u32``uid: u32``gid: u32``nlink: u64``rdev: u64``size: u64``blksize: u64``blocks: u64``atime_sec: u64``atime_nsec: u64``mtime_sec: u64``mtime_nsec: u64``ctime_sec: u64``ctime_nsec: u64``btime_sec: u64``btime_nsec: u64``gen: u64``data_version: u64

Trait Implementations

impl Debug for Rgetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rgetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rgetattr, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rgetattr

impl RefUnwindSafe for Rgetattr

impl Send for Rgetattr

impl Sync for Rgetattr

impl Unpin for Rgetattr

impl UnwindSafe for Rgetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rgetlock

pub struct Rgetlock {
    pub type_: u8,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

Fields

type_: u8``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Rgetlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rgetlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rgetlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rgetlock

impl RefUnwindSafe for Rgetlock

impl Send for Rgetlock

impl Sync for Rgetlock

impl Unpin for Rgetlock

impl UnwindSafe for Rgetlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rlcreate

pub struct Rlcreate {
    pub qid: Qid,
    pub iounit: u32,
}

Fields

qid: Qid``iounit: u32

Trait Implementations

impl Debug for Rlcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlcreate, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlcreate

impl RefUnwindSafe for Rlcreate

impl Send for Rlcreate

impl Sync for Rlcreate

impl Unpin for Rlcreate

impl UnwindSafe for Rlcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rlerror

pub struct Rlerror {
    pub ecode: u32,
}

Fields

ecode: u32

Trait Implementations

impl Debug for Rlerror

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlerror

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlerror, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlerror

impl RefUnwindSafe for Rlerror

impl Send for Rlerror

impl Sync for Rlerror

impl Unpin for Rlerror

impl UnwindSafe for Rlerror

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rlock

pub struct Rlock {
    pub status: u8,
}

Fields

status: u8

Trait Implementations

impl Debug for Rlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlock

impl RefUnwindSafe for Rlock

impl Send for Rlock

impl Sync for Rlock

impl Unpin for Rlock

impl UnwindSafe for Rlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rlopen

pub struct Rlopen {
    pub qid: Qid,
    pub iounit: u32,
}

Fields

qid: Qid``iounit: u32

Trait Implementations

impl Debug for Rlopen

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlopen

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlopen, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlopen

impl RefUnwindSafe for Rlopen

impl Send for Rlopen

impl Sync for Rlopen

impl Unpin for Rlopen

impl UnwindSafe for Rlopen

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rmkdir

pub struct Rmkdir {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rmkdir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rmkdir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rmkdir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rmkdir

impl RefUnwindSafe for Rmkdir

impl Send for Rmkdir

impl Sync for Rmkdir

impl Unpin for Rmkdir

impl UnwindSafe for Rmkdir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rmknod

pub struct Rmknod {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rmknod

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rmknod

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rmknod, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rmknod

impl RefUnwindSafe for Rmknod

impl Send for Rmknod

impl Sync for Rmknod

impl Unpin for Rmknod

impl UnwindSafe for Rmknod

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rread

pub struct Rread {
    pub data: Data,
}

Fields

data: Data

Trait Implementations

impl Debug for Rread

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rread

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rread, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rread

impl RefUnwindSafe for Rread

impl Send for Rread

impl Sync for Rread

impl Unpin for Rread

impl UnwindSafe for Rread

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rreaddir

pub struct Rreaddir {
    pub data: Data,
}

Fields

data: Data

Trait Implementations

impl Debug for Rreaddir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rreaddir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rreaddir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rreaddir

impl RefUnwindSafe for Rreaddir

impl Send for Rreaddir

impl Sync for Rreaddir

impl Unpin for Rreaddir

impl UnwindSafe for Rreaddir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rreadlink

pub struct Rreadlink {
    pub target: String,
}

Fields

target: String

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rstatfs

pub struct Rstatfs {
    pub ty: u32,
    pub bsize: u32,
    pub blocks: u64,
    pub bfree: u64,
    pub bavail: u64,
    pub files: u64,
    pub ffree: u64,
    pub fsid: u64,
    pub namelen: u32,
}

Fields

ty: u32``bsize: u32``blocks: u64``bfree: u64``bavail: u64``files: u64``ffree: u64``fsid: u64``namelen: u32

Trait Implementations

impl Debug for Rstatfs

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rstatfs

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rstatfs, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rstatfs

impl RefUnwindSafe for Rstatfs

impl Send for Rstatfs

impl Sync for Rstatfs

impl Unpin for Rstatfs

impl UnwindSafe for Rstatfs

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rsymlink

pub struct Rsymlink {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rversion

pub struct Rversion {
    pub msize: u32,
    pub version: String,
}

Fields

msize: u32``version: String

Trait Implementations

impl Debug for Rversion

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rversion

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rversion, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rversion

impl RefUnwindSafe for Rversion

impl Send for Rversion

impl Sync for Rversion

impl Unpin for Rversion

impl UnwindSafe for Rversion

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rwalk

pub struct Rwalk {
    pub wqids: Vec<Qid>,
}

Fields

wqids: Vec<Qid>

Trait Implementations

impl Debug for Rwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rwalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rwalk

impl RefUnwindSafe for Rwalk

impl Send for Rwalk

impl Sync for Rwalk

impl Unpin for Rwalk

impl UnwindSafe for Rwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rwrite

pub struct Rwrite {
    pub count: u32,
}

Fields

count: u32

Trait Implementations

impl Debug for Rwrite

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rwrite

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rwrite, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rwrite

impl RefUnwindSafe for Rwrite

impl Send for Rwrite

impl Sync for Rwrite

impl Unpin for Rwrite

impl UnwindSafe for Rwrite

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Rxattrwalk

pub struct Rxattrwalk {
    pub size: u64,
}

Fields

size: u64

Trait Implementations

impl Debug for Rxattrwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rxattrwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rxattrwalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rxattrwalk

impl RefUnwindSafe for Rxattrwalk

impl Send for Rxattrwalk

impl Sync for Rxattrwalk

impl Unpin for Rxattrwalk

impl UnwindSafe for Rxattrwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tattach

pub struct Tattach {
    pub fid: u32,
    pub afid: u32,
    pub uname: String,
    pub aname: String,
    pub n_uname: u32,
}

attach – attach to a file tree

size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s]
size[4] Rattach tag[2] qid[13]

attach associates the fid with the file tree rooted at aname.

Fields

fid: u32``afid: u32``uname: String``aname: String``n_uname: u32

Trait Implementations

impl Debug for Tattach

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tattach

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tattach, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tattach

impl RefUnwindSafe for Tattach

impl Send for Tattach

impl Sync for Tattach

impl Unpin for Tattach

impl UnwindSafe for Tattach

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tauth

pub struct Tauth {
    pub afid: u32,
    pub uname: String,
    pub aname: String,
    pub n_uname: u32,
}

auth – authenticate a user

size[4] Tauth tag[2] afid[4] uname[s] aname[s]
size[4] Rauth tag[2] aqid[13]

auth authenticates the user named uname to access the file tree with the root named aname.

afid is used as the fid in the attach message that follows auth.

Fields

afid: u32``uname: String``aname: String``n_uname: u32

Trait Implementations

impl Debug for Tauth

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tauth

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tauth, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tauth

impl RefUnwindSafe for Tauth

impl Send for Tauth

impl Sync for Tauth

impl Unpin for Tauth

impl UnwindSafe for Tauth

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tclunk

pub struct Tclunk {
    pub fid: u32,
}

clunk – remove fid

size[4] Tclunk tag[2] fid[4]
size[4] Rclunk tag[2]

clunk removes the fid from the fid table.

See the Plan 9 manual page for clunk(5).

Fields

fid: u32

Trait Implementations

impl Debug for Tclunk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tclunk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tclunk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tclunk

impl RefUnwindSafe for Tclunk

impl Send for Tclunk

impl Sync for Tclunk

impl Unpin for Tclunk

impl UnwindSafe for Tclunk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tflush

pub struct Tflush {
    pub oldtag: u16,
}

flush – abort a message

size[4] Tflush tag[2] oldtag[2]
size[4] Rflush tag[2]

flush aborts an in-flight request referenced by oldtag, if any.

See the Plan 9 manual page for flush(5).

Fields

oldtag: u16

Trait Implementations

impl Debug for Tflush

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tflush

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tflush, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tflush

impl RefUnwindSafe for Tflush

impl Send for Tflush

impl Sync for Tflush

impl Unpin for Tflush

impl UnwindSafe for Tflush

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tframe

pub struct Tframe {
    pub tag: u16,
    pub msg: Result<Tmessage, Error>,
}

Fields

tag: u16``msg: Result<Tmessage, Error>

Trait Implementations

impl Debug for Tframe

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tframe

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Tframe, Error>where R: Read,

Decodes Self from reader.

impl Message for Tframe

Auto Trait Implementations

impl Freeze for Tframe

impl !RefUnwindSafe for Tframe

impl Send for Tframe

impl Sync for Tframe

impl Unpin for Tframe

impl !UnwindSafe for Tframe

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tfsync

pub struct Tfsync {
    pub fid: u32,
    pub datasync: u32,
}

fsync – synchronize file

size[4] Tfsync tag[2] fid[4] datasync[4]
size[4] Rfsync tag[2]

fsync flushes any cached data and metadata for the file represented by fid to stable storage.

Fields

fid: u32``datasync: u32

Trait Implementations

impl Debug for Tfsync

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tfsync

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tfsync, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tfsync

impl RefUnwindSafe for Tfsync

impl Send for Tfsync

impl Sync for Tfsync

impl Unpin for Tfsync

impl UnwindSafe for Tfsync

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tgetattr

pub struct Tgetattr {
    pub fid: u32,
    pub request_mask: u64,
}

getattr – get file attributes

size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] valid[8] qid[13] mode[4] uid[4] gid[4] nlink[8]
    rdev[8] size[8] blksize[8] blocks[8] atime_sec[8] atime_nsec[8]
    mtime_sec[8] mtime_nsec[8] ctime_sec[8] ctime_nsec[8] btime_sec[8]
    btime_nsec[8] gen[8] data_version[8]

getattr gets attributes of the file system object represented by fid.

Fields

fid: u32``request_mask: u64

Trait Implementations

impl Debug for Tgetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tgetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tgetattr, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tgetattr

impl RefUnwindSafe for Tgetattr

impl Send for Tgetattr

impl Sync for Tgetattr

impl Unpin for Tgetattr

impl UnwindSafe for Tgetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tgetlock

pub struct Tgetlock {
    pub fid: u32,
    pub type_: u8,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

getlock – test for the existence of a POSIX record lock

size[4] Tgetlock tag[2] fid[4] type[1] start[8] length[8] proc_id[4] client_id[s]
size[4] Rgetlock tag[2] type[1] start[8] length[8] proc_id[4] client_id[s]

getlock tests for the existence of a POSIX record lock on the open file fid.

See the Plan 9 manual page for getlock(5).

Fields

fid: u32``type_: u8``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Tgetlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tgetlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tgetlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tgetlock

impl RefUnwindSafe for Tgetlock

impl Send for Tgetlock

impl Sync for Tgetlock

impl Unpin for Tgetlock

impl UnwindSafe for Tgetlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tlcreate

pub struct Tlcreate {
    pub fid: u32,
    pub name: String,
    pub flags: u32,
    pub mode: u32,
    pub gid: u32,
}

lcreate – create a file

size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]
size[4] Rlcreate tag[2] qid[13] iounit[4]

lcreate creates a new file name in the directory represented by fid and prepares it for I/O. The flags field has the standard open(2) values.

Fields

fid: u32``name: String``flags: u32``mode: u32``gid: u32

Trait Implementations

impl Debug for Tlcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tlcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tlcreate, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlcreate

impl RefUnwindSafe for Tlcreate

impl Send for Tlcreate

impl Sync for Tlcreate

impl Unpin for Tlcreate

impl UnwindSafe for Tlcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tlink

pub struct Tlink {
    pub dfid: u32,
    pub fid: u32,
    pub name: String,
}

link – create hard link

size[4] Tlink tag[2] dfid[4] fid[4] name[s]
size[4] Rlink tag[2]

link creates a new hard link name in the directory dfid that refers to the same file as fid.

Fields

dfid: u32``fid: u32``name: String

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tlock

pub struct Tlock {
    pub fid: u32,
    pub type_: u8,
    pub flags: u32,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

lock – acquire or release a POSIX record lock

size[4] Tlock tag[2] fid[4] type[1] flags[4] start[8] length[8] proc_id[4] client_id[s]
size[4] Rlock tag[2] status[1]

lock acquires or releases a POSIX record lock on the open file fid.

See the Plan 9 manual page for lock(5).

Fields

fid: u32``type_: u8``flags: u32``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Tlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlock

impl RefUnwindSafe for Tlock

impl Send for Tlock

impl Sync for Tlock

impl Unpin for Tlock

impl UnwindSafe for Tlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tlopen

pub struct Tlopen {
    pub fid: u32,
    pub flags: u32,
}

lopen – open a file

size[4] Tlopen tag[2] fid[4] flags[4]
size[4] Rlopen tag[2] qid[13] iounit[4]

lopen prepares fid for file I/O. The flags field has the standard open(2) values.

Fields

fid: u32``flags: u32

Trait Implementations

impl Debug for Tlopen

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tlopen

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tlopen, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlopen

impl RefUnwindSafe for Tlopen

impl Send for Tlopen

impl Sync for Tlopen

impl Unpin for Tlopen

impl UnwindSafe for Tlopen

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tmkdir

pub struct Tmkdir {
    pub dfid: u32,
    pub name: String,
    pub mode: u32,
    pub gid: u32,
}

mkdir – create directory

size[4] Tmkdir tag[2] dfid[4] name[s] mode[4] gid[4]
size[4] Rmkdir tag[2] qid[13]

mkdir creates a new directory name in the directory represented by dfid.

Fields

dfid: u32``name: String``mode: u32``gid: u32

Trait Implementations

impl Debug for Tmkdir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tmkdir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tmkdir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tmkdir

impl RefUnwindSafe for Tmkdir

impl Send for Tmkdir

impl Sync for Tmkdir

impl Unpin for Tmkdir

impl UnwindSafe for Tmkdir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tmknod

pub struct Tmknod {
    pub dfid: u32,
    pub name: String,
    pub mode: u32,
    pub major: u32,
    pub minor: u32,
    pub gid: u32,
}

mknod – create a special file

size[4] Tmknod tag[2] dfid[4] name[s] mode[4] major[4] minor[4] gid[4]
size[4] Rmknod tag[2] qid[13]

mknod creates a new special file name in the directory represented by dfid.

Fields

dfid: u32``name: String``mode: u32``major: u32``minor: u32``gid: u32

Trait Implementations

impl Debug for Tmknod

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tmknod

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tmknod, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tmknod

impl RefUnwindSafe for Tmknod

impl Send for Tmknod

impl Sync for Tmknod

impl Unpin for Tmknod

impl UnwindSafe for Tmknod

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tread

pub struct Tread {
    pub fid: u32,
    pub offset: u64,
    pub count: u32,
}

read – read data from a file

size[4] Tread tag[2] fid[4] offset[8] count[4]
size[4] Rread tag[2] count[4] data[count]

read performs I/O on the file represented by fid.

Under 9P2000.L, read cannot be used on directories. See Treaddir for reading directories.

See the Plan 9 manual page for read(5).

Fields

fid: u32``offset: u64``count: u32

Trait Implementations

impl Debug for Tread

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tread

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tread, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tread

impl RefUnwindSafe for Tread

impl Send for Tread

impl Sync for Tread

impl Unpin for Tread

impl UnwindSafe for Tread

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Treaddir

pub struct Treaddir {
    pub fid: u32,
    pub offset: u64,
    pub count: u32,
}

readdir – read directory entries

size[4] Treaddir tag[2] fid[4] offset[8] count[4]
size[4] Rreaddir tag[2] count[4] data[count]

readdir reads directory entries from the directory represented by fid.

Fields

fid: u32``offset: u64``count: u32

Trait Implementations

impl Debug for Treaddir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Treaddir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Treaddir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Treaddir

impl RefUnwindSafe for Treaddir

impl Send for Treaddir

impl Sync for Treaddir

impl Unpin for Treaddir

impl UnwindSafe for Treaddir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Treadlink

pub struct Treadlink {
    pub fid: u32,
}

readlink – read symlink value

size[4] Treadlink tag[2] fid[4]
size[4] Rreadlink tag[2] target[s]

readlink reads the target of the symbolic link represented by fid.

Fields

fid: u32

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tremove

pub struct Tremove {
    pub fid: u32,
}

remove – remove a file

size[4] Tremove tag[2] fid[4]
size[4] Rremove tag[2]

remove removes the file represented by fid.

See the Plan 9 manual page for remove(5).

Fields

fid: u32

Trait Implementations

impl Debug for Tremove

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tremove

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tremove, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tremove

impl RefUnwindSafe for Tremove

impl Send for Tremove

impl Sync for Tremove

impl Unpin for Tremove

impl UnwindSafe for Tremove

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Trename

pub struct Trename {
    pub fid: u32,
    pub dfid: u32,
    pub name: String,
}

rename – rename a file

size[4] Trename tag[2] fid[4] dfid[4] name[s]
size[4] Rrename tag[2]

rename renames a file or directory from old name to new name in the directory represented by dfid. fid represents the file to be renamed.

Fields

fid: u32``dfid: u32``name: String

Trait Implementations

impl Debug for Trename

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Trename

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Trename, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Trename

impl RefUnwindSafe for Trename

impl Send for Trename

impl Sync for Trename

impl Unpin for Trename

impl UnwindSafe for Trename

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Trenameat

pub struct Trenameat {
    pub olddirfid: u32,
    pub oldname: String,
    pub newdirfid: u32,
    pub newname: String,
}

renameat – rename a file or directory

size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s]
size[4] Rrenameat tag[2]

renameat renames a file or directory from oldname in the directory represented by olddirfid to newname in the directory represented by newdirfid.

Fields

olddirfid: u32``oldname: String``newdirfid: u32``newname: String

Trait Implementations

impl Debug for Trenameat

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Trenameat

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Trenameat, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Trenameat

impl RefUnwindSafe for Trenameat

impl Send for Trenameat

impl Sync for Trenameat

impl Unpin for Trenameat

impl UnwindSafe for Trenameat

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tsetattr

pub struct Tsetattr {
    pub fid: u32,
    pub valid: u32,
    pub mode: u32,
    pub uid: u32,
    pub gid: u32,
    pub size: u64,
    pub atime_sec: u64,
    pub atime_nsec: u64,
    pub mtime_sec: u64,
    pub mtime_nsec: u64,
}

setattr – set file attributes

size[4] Tsetattr tag[2] fid[4] valid[4] mode[4] uid[4] gid[4] size[8]
    atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8]
size[4] Rsetattr tag[2]

setattr sets attributes of the file system object represented by fid.

Fields

fid: u32``valid: u32``mode: u32``uid: u32``gid: u32``size: u64``atime_sec: u64``atime_nsec: u64``mtime_sec: u64``mtime_nsec: u64

Trait Implementations

impl Debug for Tsetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tsetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tsetattr, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tsetattr

impl RefUnwindSafe for Tsetattr

impl Send for Tsetattr

impl Sync for Tsetattr

impl Unpin for Tsetattr

impl UnwindSafe for Tsetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tstatfs

pub struct Tstatfs {
    pub fid: u32,
}

statfs – get file system information

size[4] Tstatfs tag[2] fid[4]
size[4] Rstatfs tag[2] type[4] bsize[4] blocks[8] bfree[8] bavail[8]
                       files[8] ffree[8] fsid[8] namelen[4]

statfs is used to request file system information of the file system containing fid. The Rstatfs response corresponds to the fields returned by the statfs(2) system call.

Fields

fid: u32

Trait Implementations

impl Debug for Tstatfs

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tstatfs

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tstatfs, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tstatfs

impl RefUnwindSafe for Tstatfs

impl Send for Tstatfs

impl Sync for Tstatfs

impl Unpin for Tstatfs

impl UnwindSafe for Tstatfs

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tsymlink

pub struct Tsymlink {
    pub fid: u32,
    pub name: String,
    pub symtgt: String,
    pub gid: u32,
}

symlink – create symlink

size[4] Tsymlink tag[2] fid[4] name[s] symtgt[s] gid[4]
size[4] Rsymlink tag[2] qid[13]

symlink creates a new symbolic link name in the directory represented by fid.

Fields

fid: u32``name: String``symtgt: String``gid: u32

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tunlinkat

pub struct Tunlinkat {
    pub dirfd: u32,
    pub name: String,
    pub flags: u32,
}

unlinkat – unlink a file or directory

size[4] Tunlinkat tag[2] dirfd[4] name[s] flags[4]
size[4] Runlinkat tag[2]

unlinkat removes the file name from the directory represented by dirfd.

Fields

dirfd: u32``name: String``flags: u32

Trait Implementations

impl Debug for Tunlinkat

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tunlinkat

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tunlinkat, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tunlinkat

impl RefUnwindSafe for Tunlinkat

impl Send for Tunlinkat

impl Sync for Tunlinkat

impl Unpin for Tunlinkat

impl UnwindSafe for Tunlinkat

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Tversion

pub struct Tversion {
    pub msize: u32,
    pub version: String,
}

version – negotiate protocol version

size[4] Tversion tag[2] msize[4] version[s]
size[4] Rversion tag[2] msize[4] version[s]

version establishes the msize, which is the maximum message size inclusive of the size value that can be handled by both client and server.

It also establishes the protocol version. For 9P2000.L version must be the string 9P2000.L.

See the Plan 9 manual page for version(5).

Fields

msize: u32``version: String

Trait Implementations

impl Debug for Tversion

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tversion

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tversion, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tversion

impl RefUnwindSafe for Tversion

impl Send for Tversion

impl Sync for Tversion

impl Unpin for Tversion

impl UnwindSafe for Tversion

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Twalk

pub struct Twalk {
    pub fid: u32,
    pub newfid: u32,
    pub wnames: Vec<String>,
}

walk – descend a directory hierarchy

size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s])
size[4] Rwalk tag[2] nwqid[2] nwqid*(wqid[13])

walk is used to descend a directory represented by fid using successive path elements provided in the wname array. If successful, newfid represents the new path.

fid can be cloned to newfid by calling walk with nwname set to zero.

See the Plan 9 manual page for walk(5).

Fields

fid: u32``newfid: u32``wnames: Vec<String>

Trait Implementations

impl Debug for Twalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Twalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Twalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Twalk

impl RefUnwindSafe for Twalk

impl Send for Twalk

impl Sync for Twalk

impl Unpin for Twalk

impl UnwindSafe for Twalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Twrite

pub struct Twrite {
    pub fid: u32,
    pub offset: u64,
    pub data: Data,
}

write – write data to a file

size[4] Twrite tag[2] fid[4] offset[8] data[count]
size[4] Rwrite tag[2] count[4]

write performs I/O on the file represented by fid.

See the Plan 9 manual page for write(5).

Fields

fid: u32``offset: u64``data: Data

Trait Implementations

impl Debug for Twrite

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Twrite

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Twrite, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Twrite

impl RefUnwindSafe for Twrite

impl Send for Twrite

impl Sync for Twrite

impl Unpin for Twrite

impl UnwindSafe for Twrite

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Txattrcreate

pub struct Txattrcreate {
    pub fid: u32,
    pub name: String,
    pub attr_size: u64,
    pub flags: u32,
}

xattrcreate – create an extended attribute

size[4] Txattrcreate tag[2] fid[4] name[s] attr_size[8] flags[4]
size[4] Rxattrcreate tag[2]

xattrcreate creates a new extended attribute named name of the file represented by fid.

Fields

fid: u32``name: String``attr_size: u64``flags: u32

Trait Implementations

impl Debug for Txattrcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Txattrcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Txattrcreate, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Txattrcreate

impl RefUnwindSafe for Txattrcreate

impl Send for Txattrcreate

impl Sync for Txattrcreate

impl Unpin for Txattrcreate

impl UnwindSafe for Txattrcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9::messages

Struct Txattrwalk

pub struct Txattrwalk {
    pub fid: u32,
    pub newfid: u32,
    pub name: String,
}

xattrwalk – walk extended attributes

size[4] Txattrwalk tag[2] fid[4] newfid[4] name[s]
size[4] Rxattrwalk tag[2] size[8]

xattrwalk gets a new fid pointing to the extended attribute directory of the file represented by fid.

Fields

fid: u32``newfid: u32``name: String

Trait Implementations

impl Debug for Txattrwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Txattrwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Txattrwalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Txattrwalk

impl RefUnwindSafe for Txattrwalk

impl Send for Txattrwalk

impl Sync for Txattrwalk

impl Unpin for Txattrwalk

impl UnwindSafe for Txattrwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Module ninep_2000_l

Traits

  • Nine``P200L: 9p

jetstream::prelude::p9::ninep_2000_l

Trait NineP200L

pub trait NineP200L: Send + Sync {
    // Required methods
    fn version(
        &mut self,
        tag: u16,
        version: &Tversion,
    ) -> impl Future<Output = Result<Rversion, Error>> + Send + Sync;
    fn auth(
        &mut self,
        tag: u16,
        auth: &Tauth,
    ) -> impl Future<Output = Result<Rauth, Error>> + Send + Sync;
    fn flush(
        &mut self,
        tag: u16,
        flush: &Tflush,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn walk(
        &mut self,
        tag: u16,
        walk: &Twalk,
    ) -> impl Future<Output = Result<Rwalk, Error>> + Send + Sync;
    fn read(
        &mut self,
        tag: u16,
        read: &Tread,
    ) -> impl Future<Output = Result<Rread, Error>> + Send + Sync;
    fn write(
        &mut self,
        tag: u16,
        write: &Twrite,
    ) -> impl Future<Output = Result<Rwrite, Error>> + Send + Sync;
    fn clunk(
        &mut self,
        tag: u16,
        clunk: &Tclunk,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn remove(
        &mut self,
        tag: u16,
        remove: &Tremove,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn attach(
        &mut self,
        tag: u16,
        attach: &Tattach,
    ) -> impl Future<Output = Result<Rattach, Error>> + Send + Sync;
    fn statfs(
        &mut self,
        tag: u16,
        statfs: &Tstatfs,
    ) -> impl Future<Output = Result<Rstatfs, Error>> + Send + Sync;
    fn lopen(
        &mut self,
        tag: u16,
        lopen: &Tlopen,
    ) -> impl Future<Output = Result<Rlopen, Error>> + Send + Sync;
    fn lcreate(
        &mut self,
        tag: u16,
        lcreate: &Tlcreate,
    ) -> impl Future<Output = Result<Rlcreate, Error>> + Send + Sync;
    fn symlink(
        &mut self,
        tag: u16,
        symlink: &Tsymlink,
    ) -> impl Future<Output = Result<Rsymlink, Error>> + Send + Sync;
    fn mknod(
        &mut self,
        tag: u16,
        mknod: &Tmknod,
    ) -> impl Future<Output = Result<Rmknod, Error>> + Send + Sync;
    fn rename(
        &mut self,
        tag: u16,
        rename: &Trename,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn readlink(
        &mut self,
        tag: u16,
        readlink: &Treadlink,
    ) -> impl Future<Output = Result<Rreadlink, Error>> + Send + Sync;
    fn get_attr(
        &mut self,
        tag: u16,
        get_attr: &Tgetattr,
    ) -> impl Future<Output = Result<Rgetattr, Error>> + Send + Sync;
    fn set_attr(
        &mut self,
        tag: u16,
        set_attr: &Tsetattr,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn xattr_walk(
        &mut self,
        tag: u16,
        xattr_walk: &Txattrwalk,
    ) -> impl Future<Output = Result<Rxattrwalk, Error>> + Send + Sync;
    fn xattr_create(
        &mut self,
        tag: u16,
        xattr_create: &Txattrcreate,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn readdir(
        &mut self,
        tag: u16,
        readdir: &Treaddir,
    ) -> impl Future<Output = Result<Rreaddir, Error>> + Send + Sync;
    fn fsync(
        &mut self,
        tag: u16,
        fsync: &Tfsync,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn lock(
        &mut self,
        tag: u16,
        lock: &Tlock,
    ) -> impl Future<Output = Result<Rlock, Error>> + Send + Sync;
    fn get_lock(
        &mut self,
        tag: u16,
        get_lock: &Tgetlock,
    ) -> impl Future<Output = Result<Rgetlock, Error>> + Send + Sync;
    fn link(
        &mut self,
        tag: u16,
        link: &Tlink,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn mkdir(
        &mut self,
        tag: u16,
        mkdir: &Tmkdir,
    ) -> impl Future<Output = Result<Rmkdir, Error>> + Send + Sync;
    fn rename_at(
        &mut self,
        tag: u16,
        rename_at: &Trenameat,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
    fn unlink_at(
        &mut self,
        tag: u16,
        unlink_at: &Tunlinkat,
    ) -> impl Future<Output = Result<(), Error>> + Send + Sync;
}

9p

Required Methods

fn version( &mut self, tag: u16, version: &Tversion, ) -> impl Future<Output = Result<Rversion, Error>> + Send + Sync

The version message is the first message sent on a connection. It is used to negotiate the 9P protocol version and maximum message size.

fn auth( &mut self, tag: u16, auth: &Tauth, ) -> impl Future<Output = Result<Rauth, Error>> + Send + Sync

The auth message is used to authenticate a user to the server. It is sent after the version message and before any other messages. The auth message is optional and may be ignored by the server.

fn flush( &mut self, tag: u16, flush: &Tflush, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The flush message is used to flush pending I/O requests.

fn walk( &mut self, tag: u16, walk: &Twalk, ) -> impl Future<Output = Result<Rwalk, Error>> + Send + Sync

The walk message is used to traverse the file system hierarchy. It is sent by the client and responded to by the server.

fn read( &mut self, tag: u16, read: &Tread, ) -> impl Future<Output = Result<Rread, Error>> + Send + Sync

The read message is used to read data from a file.

fn write( &mut self, tag: u16, write: &Twrite, ) -> impl Future<Output = Result<Rwrite, Error>> + Send + Sync

The write message is used to write data to a file.

fn clunk( &mut self, tag: u16, clunk: &Tclunk, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The clunk message is used to release a fid.

fn remove( &mut self, tag: u16, remove: &Tremove, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The remove message is used to remove a file.

fn attach( &mut self, tag: u16, attach: &Tattach, ) -> impl Future<Output = Result<Rattach, Error>> + Send + Sync

The attach message is used to associate a fid with a file.

fn statfs( &mut self, tag: u16, statfs: &Tstatfs, ) -> impl Future<Output = Result<Rstatfs, Error>> + Send + Sync

The statfs message is used to retrieve file system information.

fn lopen( &mut self, tag: u16, lopen: &Tlopen, ) -> impl Future<Output = Result<Rlopen, Error>> + Send + Sync

The lopen message is used to open a file.

fn lcreate( &mut self, tag: u16, lcreate: &Tlcreate, ) -> impl Future<Output = Result<Rlcreate, Error>> + Send + Sync

The lcreate message is used to create a file.

The symlink message is used to create a symbolic link.

fn mknod( &mut self, tag: u16, mknod: &Tmknod, ) -> impl Future<Output = Result<Rmknod, Error>> + Send + Sync

The mknod message is used to create a device file.

fn rename( &mut self, tag: u16, rename: &Trename, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The rename message is used to rename a file.

The readlink message is used to read the target of a symbolic link.

fn get_attr( &mut self, tag: u16, get_attr: &Tgetattr, ) -> impl Future<Output = Result<Rgetattr, Error>> + Send + Sync

The getattr message is used to retrieve file attributes.

fn set_attr( &mut self, tag: u16, set_attr: &Tsetattr, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The setattr message is used to set file attributes.

fn xattr_walk( &mut self, tag: u16, xattr_walk: &Txattrwalk, ) -> impl Future<Output = Result<Rxattrwalk, Error>> + Send + Sync

The xattrwalk message is used to traverse extended attributes.

fn xattr_create( &mut self, tag: u16, xattr_create: &Txattrcreate, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The xattrcreate message is used to create an extended attribute.

fn readdir( &mut self, tag: u16, readdir: &Treaddir, ) -> impl Future<Output = Result<Rreaddir, Error>> + Send + Sync

The readdir message is used to read a directory.

fn fsync( &mut self, tag: u16, fsync: &Tfsync, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The fsync message is used to synchronize a file’s data and metadata.

fn lock( &mut self, tag: u16, lock: &Tlock, ) -> impl Future<Output = Result<Rlock, Error>> + Send + Sync

The lock message is used to lock a file.

fn get_lock( &mut self, tag: u16, get_lock: &Tgetlock, ) -> impl Future<Output = Result<Rgetlock, Error>> + Send + Sync

The getlock message is used to retrieve a file’s locks.

The link message is used to create a hard link.

fn mkdir( &mut self, tag: u16, mkdir: &Tmkdir, ) -> impl Future<Output = Result<Rmkdir, Error>> + Send + Sync

The mkdir message is used to create a directory.

fn rename_at( &mut self, tag: u16, rename_at: &Trenameat, ) -> impl Future<Output = Result<(), Error>> + Send + Sync

The renameat message is used to rename a file.

The unlinkat message is used to remove a file.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream::prelude::p9

Struct Dirent

pub struct Dirent {
    pub qid: Qid,
    pub offset: u64,
    pub ty: u8,
    pub name: String,
}

Dirent – directory entry

Fields

qid: Qid``offset: u64``ty: u8``name: String

Trait Implementations

impl Debug for Dirent

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Dirent

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Dirent, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Dirent

impl RefUnwindSafe for Dirent

impl Send for Dirent

impl Sync for Dirent

impl Unpin for Dirent

impl UnwindSafe for Dirent

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Qid

pub struct Qid {
    pub ty: u8,
    pub version: u32,
    pub path: u64,
}

Qid

Fields

ty: u8``version: u32``path: u64

Trait Implementations

impl Clone for Qid

fn clone(&self) -> Qid

Returns a copy of the value. Read more1.0.0 ·

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for Qid

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl From for Qid

fn from(st: stat64) -> Qid

Converts to this type from the input type.

impl Hash for Qid

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more1.3.0 ·

fn hash_slice(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq for Qid

fn eq(&self, other: &Qid) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl WireFormat for Qid

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Qid, Error>where R: Read,

Decodes Self from reader.

impl Copy for Qid

impl Eq for Qid

impl StructuralPartialEq for Qid

Auto Trait Implementations

impl Freeze for Qid

impl RefUnwindSafe for Qid

impl Send for Qid

impl Sync for Qid

impl Unpin for Qid

impl UnwindSafe for Qid

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl CloneToUninit for Twhere T: Clone,

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)Performs copy-assignment from self to dst. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl ToOwned for Twhere T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rattach

pub struct Rattach {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rattach

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rattach

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rattach, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rattach

impl RefUnwindSafe for Rattach

impl Send for Rattach

impl Sync for Rattach

impl Unpin for Rattach

impl UnwindSafe for Rattach

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rauth

pub struct Rauth {
    pub aqid: Qid,
}

Fields

aqid: Qid

Trait Implementations

impl Debug for Rauth

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rauth

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rauth, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rauth

impl RefUnwindSafe for Rauth

impl Send for Rauth

impl Sync for Rauth

impl Unpin for Rauth

impl UnwindSafe for Rauth

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rerror

pub struct Rerror {
    pub ename: String,
}

Fields

ename: String

Trait Implementations

impl Debug for Rerror

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rerror

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rerror, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rerror

impl RefUnwindSafe for Rerror

impl Send for Rerror

impl Sync for Rerror

impl Unpin for Rerror

impl UnwindSafe for Rerror

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rframe

pub struct Rframe {
    pub tag: u16,
    pub msg: Rmessage,
}

Fields

tag: u16``msg: Rmessage

Trait Implementations

impl Debug for Rframe

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rframe

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Rframe, Error>where R: Read,

Decodes Self from reader.

impl Message for Rframe

Auto Trait Implementations

impl Freeze for Rframe

impl RefUnwindSafe for Rframe

impl Send for Rframe

impl Sync for Rframe

impl Unpin for Rframe

impl UnwindSafe for Rframe

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rgetattr

pub struct Rgetattr {
    pub valid: u64,
    pub qid: Qid,
    pub mode: u32,
    pub uid: u32,
    pub gid: u32,
    pub nlink: u64,
    pub rdev: u64,
    pub size: u64,
    pub blksize: u64,
    pub blocks: u64,
    pub atime_sec: u64,
    pub atime_nsec: u64,
    pub mtime_sec: u64,
    pub mtime_nsec: u64,
    pub ctime_sec: u64,
    pub ctime_nsec: u64,
    pub btime_sec: u64,
    pub btime_nsec: u64,
    pub gen: u64,
    pub data_version: u64,
}

Fields

valid: u64``qid: Qid``mode: u32``uid: u32``gid: u32``nlink: u64``rdev: u64``size: u64``blksize: u64``blocks: u64``atime_sec: u64``atime_nsec: u64``mtime_sec: u64``mtime_nsec: u64``ctime_sec: u64``ctime_nsec: u64``btime_sec: u64``btime_nsec: u64``gen: u64``data_version: u64

Trait Implementations

impl Debug for Rgetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rgetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rgetattr, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rgetattr

impl RefUnwindSafe for Rgetattr

impl Send for Rgetattr

impl Sync for Rgetattr

impl Unpin for Rgetattr

impl UnwindSafe for Rgetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rgetlock

pub struct Rgetlock {
    pub type_: u8,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

Fields

type_: u8``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Rgetlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rgetlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rgetlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rgetlock

impl RefUnwindSafe for Rgetlock

impl Send for Rgetlock

impl Sync for Rgetlock

impl Unpin for Rgetlock

impl UnwindSafe for Rgetlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rlcreate

pub struct Rlcreate {
    pub qid: Qid,
    pub iounit: u32,
}

Fields

qid: Qid``iounit: u32

Trait Implementations

impl Debug for Rlcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlcreate, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlcreate

impl RefUnwindSafe for Rlcreate

impl Send for Rlcreate

impl Sync for Rlcreate

impl Unpin for Rlcreate

impl UnwindSafe for Rlcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rlerror

pub struct Rlerror {
    pub ecode: u32,
}

Fields

ecode: u32

Trait Implementations

impl Debug for Rlerror

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlerror

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlerror, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlerror

impl RefUnwindSafe for Rlerror

impl Send for Rlerror

impl Sync for Rlerror

impl Unpin for Rlerror

impl UnwindSafe for Rlerror

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rlock

pub struct Rlock {
    pub status: u8,
}

Fields

status: u8

Trait Implementations

impl Debug for Rlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlock

impl RefUnwindSafe for Rlock

impl Send for Rlock

impl Sync for Rlock

impl Unpin for Rlock

impl UnwindSafe for Rlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rlopen

pub struct Rlopen {
    pub qid: Qid,
    pub iounit: u32,
}

Fields

qid: Qid``iounit: u32

Trait Implementations

impl Debug for Rlopen

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rlopen

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rlopen, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlopen

impl RefUnwindSafe for Rlopen

impl Send for Rlopen

impl Sync for Rlopen

impl Unpin for Rlopen

impl UnwindSafe for Rlopen

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rmkdir

pub struct Rmkdir {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rmkdir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rmkdir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rmkdir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rmkdir

impl RefUnwindSafe for Rmkdir

impl Send for Rmkdir

impl Sync for Rmkdir

impl Unpin for Rmkdir

impl UnwindSafe for Rmkdir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rmknod

pub struct Rmknod {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rmknod

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rmknod

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rmknod, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rmknod

impl RefUnwindSafe for Rmknod

impl Send for Rmknod

impl Sync for Rmknod

impl Unpin for Rmknod

impl UnwindSafe for Rmknod

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rread

pub struct Rread {
    pub data: Data,
}

Fields

data: Data

Trait Implementations

impl Debug for Rread

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rread

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rread, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rread

impl RefUnwindSafe for Rread

impl Send for Rread

impl Sync for Rread

impl Unpin for Rread

impl UnwindSafe for Rread

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rreaddir

pub struct Rreaddir {
    pub data: Data,
}

Fields

data: Data

Trait Implementations

impl Debug for Rreaddir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rreaddir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rreaddir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rreaddir

impl RefUnwindSafe for Rreaddir

impl Send for Rreaddir

impl Sync for Rreaddir

impl Unpin for Rreaddir

impl UnwindSafe for Rreaddir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rreadlink

pub struct Rreadlink {
    pub target: String,
}

Fields

target: String

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rstatfs

pub struct Rstatfs {
    pub ty: u32,
    pub bsize: u32,
    pub blocks: u64,
    pub bfree: u64,
    pub bavail: u64,
    pub files: u64,
    pub ffree: u64,
    pub fsid: u64,
    pub namelen: u32,
}

Fields

ty: u32``bsize: u32``blocks: u64``bfree: u64``bavail: u64``files: u64``ffree: u64``fsid: u64``namelen: u32

Trait Implementations

impl Debug for Rstatfs

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rstatfs

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rstatfs, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rstatfs

impl RefUnwindSafe for Rstatfs

impl Send for Rstatfs

impl Sync for Rstatfs

impl Unpin for Rstatfs

impl UnwindSafe for Rstatfs

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rsymlink

pub struct Rsymlink {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rversion

pub struct Rversion {
    pub msize: u32,
    pub version: String,
}

Fields

msize: u32``version: String

Trait Implementations

impl Debug for Rversion

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rversion

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rversion, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rversion

impl RefUnwindSafe for Rversion

impl Send for Rversion

impl Sync for Rversion

impl Unpin for Rversion

impl UnwindSafe for Rversion

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rwalk

pub struct Rwalk {
    pub wqids: Vec<Qid>,
}

Fields

wqids: Vec<Qid>

Trait Implementations

impl Debug for Rwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rwalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rwalk

impl RefUnwindSafe for Rwalk

impl Send for Rwalk

impl Sync for Rwalk

impl Unpin for Rwalk

impl UnwindSafe for Rwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rwrite

pub struct Rwrite {
    pub count: u32,
}

Fields

count: u32

Trait Implementations

impl Debug for Rwrite

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rwrite

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rwrite, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rwrite

impl RefUnwindSafe for Rwrite

impl Send for Rwrite

impl Sync for Rwrite

impl Unpin for Rwrite

impl UnwindSafe for Rwrite

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Rxattrwalk

pub struct Rxattrwalk {
    pub size: u64,
}

Fields

size: u64

Trait Implementations

impl Debug for Rxattrwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Rxattrwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Rxattrwalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rxattrwalk

impl RefUnwindSafe for Rxattrwalk

impl Send for Rxattrwalk

impl Sync for Rxattrwalk

impl Unpin for Rxattrwalk

impl UnwindSafe for Rxattrwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tattach

pub struct Tattach {
    pub fid: u32,
    pub afid: u32,
    pub uname: String,
    pub aname: String,
    pub n_uname: u32,
}

attach – attach to a file tree

size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s]
size[4] Rattach tag[2] qid[13]

attach associates the fid with the file tree rooted at aname.

Fields

fid: u32``afid: u32``uname: String``aname: String``n_uname: u32

Trait Implementations

impl Debug for Tattach

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tattach

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tattach, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tattach

impl RefUnwindSafe for Tattach

impl Send for Tattach

impl Sync for Tattach

impl Unpin for Tattach

impl UnwindSafe for Tattach

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tauth

pub struct Tauth {
    pub afid: u32,
    pub uname: String,
    pub aname: String,
    pub n_uname: u32,
}

auth – authenticate a user

size[4] Tauth tag[2] afid[4] uname[s] aname[s]
size[4] Rauth tag[2] aqid[13]

auth authenticates the user named uname to access the file tree with the root named aname.

afid is used as the fid in the attach message that follows auth.

Fields

afid: u32``uname: String``aname: String``n_uname: u32

Trait Implementations

impl Debug for Tauth

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tauth

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tauth, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tauth

impl RefUnwindSafe for Tauth

impl Send for Tauth

impl Sync for Tauth

impl Unpin for Tauth

impl UnwindSafe for Tauth

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tclunk

pub struct Tclunk {
    pub fid: u32,
}

clunk – remove fid

size[4] Tclunk tag[2] fid[4]
size[4] Rclunk tag[2]

clunk removes the fid from the fid table.

See the Plan 9 manual page for clunk(5).

Fields

fid: u32

Trait Implementations

impl Debug for Tclunk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tclunk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tclunk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tclunk

impl RefUnwindSafe for Tclunk

impl Send for Tclunk

impl Sync for Tclunk

impl Unpin for Tclunk

impl UnwindSafe for Tclunk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tflush

pub struct Tflush {
    pub oldtag: u16,
}

flush – abort a message

size[4] Tflush tag[2] oldtag[2]
size[4] Rflush tag[2]

flush aborts an in-flight request referenced by oldtag, if any.

See the Plan 9 manual page for flush(5).

Fields

oldtag: u16

Trait Implementations

impl Debug for Tflush

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tflush

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tflush, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tflush

impl RefUnwindSafe for Tflush

impl Send for Tflush

impl Sync for Tflush

impl Unpin for Tflush

impl UnwindSafe for Tflush

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tframe

pub struct Tframe {
    pub tag: u16,
    pub msg: Result<Tmessage, Error>,
}

Fields

tag: u16``msg: Result<Tmessage, Error>

Trait Implementations

impl Debug for Tframe

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tframe

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Tframe, Error>where R: Read,

Decodes Self from reader.

impl Message for Tframe

Auto Trait Implementations

impl Freeze for Tframe

impl !RefUnwindSafe for Tframe

impl Send for Tframe

impl Sync for Tframe

impl Unpin for Tframe

impl !UnwindSafe for Tframe

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tfsync

pub struct Tfsync {
    pub fid: u32,
    pub datasync: u32,
}

fsync – synchronize file

size[4] Tfsync tag[2] fid[4] datasync[4]
size[4] Rfsync tag[2]

fsync flushes any cached data and metadata for the file represented by fid to stable storage.

Fields

fid: u32``datasync: u32

Trait Implementations

impl Debug for Tfsync

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tfsync

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tfsync, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tfsync

impl RefUnwindSafe for Tfsync

impl Send for Tfsync

impl Sync for Tfsync

impl Unpin for Tfsync

impl UnwindSafe for Tfsync

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tgetattr

pub struct Tgetattr {
    pub fid: u32,
    pub request_mask: u64,
}

getattr – get file attributes

size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] valid[8] qid[13] mode[4] uid[4] gid[4] nlink[8]
    rdev[8] size[8] blksize[8] blocks[8] atime_sec[8] atime_nsec[8]
    mtime_sec[8] mtime_nsec[8] ctime_sec[8] ctime_nsec[8] btime_sec[8]
    btime_nsec[8] gen[8] data_version[8]

getattr gets attributes of the file system object represented by fid.

Fields

fid: u32``request_mask: u64

Trait Implementations

impl Debug for Tgetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tgetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tgetattr, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tgetattr

impl RefUnwindSafe for Tgetattr

impl Send for Tgetattr

impl Sync for Tgetattr

impl Unpin for Tgetattr

impl UnwindSafe for Tgetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tgetlock

pub struct Tgetlock {
    pub fid: u32,
    pub type_: u8,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

getlock – test for the existence of a POSIX record lock

size[4] Tgetlock tag[2] fid[4] type[1] start[8] length[8] proc_id[4] client_id[s]
size[4] Rgetlock tag[2] type[1] start[8] length[8] proc_id[4] client_id[s]

getlock tests for the existence of a POSIX record lock on the open file fid.

See the Plan 9 manual page for getlock(5).

Fields

fid: u32``type_: u8``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Tgetlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tgetlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tgetlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tgetlock

impl RefUnwindSafe for Tgetlock

impl Send for Tgetlock

impl Sync for Tgetlock

impl Unpin for Tgetlock

impl UnwindSafe for Tgetlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tlcreate

pub struct Tlcreate {
    pub fid: u32,
    pub name: String,
    pub flags: u32,
    pub mode: u32,
    pub gid: u32,
}

lcreate – create a file

size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]
size[4] Rlcreate tag[2] qid[13] iounit[4]

lcreate creates a new file name in the directory represented by fid and prepares it for I/O. The flags field has the standard open(2) values.

Fields

fid: u32``name: String``flags: u32``mode: u32``gid: u32

Trait Implementations

impl Debug for Tlcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tlcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tlcreate, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlcreate

impl RefUnwindSafe for Tlcreate

impl Send for Tlcreate

impl Sync for Tlcreate

impl Unpin for Tlcreate

impl UnwindSafe for Tlcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tlink

pub struct Tlink {
    pub dfid: u32,
    pub fid: u32,
    pub name: String,
}

link – create hard link

size[4] Tlink tag[2] dfid[4] fid[4] name[s]
size[4] Rlink tag[2]

link creates a new hard link name in the directory dfid that refers to the same file as fid.

Fields

dfid: u32``fid: u32``name: String

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tlock

pub struct Tlock {
    pub fid: u32,
    pub type_: u8,
    pub flags: u32,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

lock – acquire or release a POSIX record lock

size[4] Tlock tag[2] fid[4] type[1] flags[4] start[8] length[8] proc_id[4] client_id[s]
size[4] Rlock tag[2] status[1]

lock acquires or releases a POSIX record lock on the open file fid.

See the Plan 9 manual page for lock(5).

Fields

fid: u32``type_: u8``flags: u32``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Tlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tlock, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlock

impl RefUnwindSafe for Tlock

impl Send for Tlock

impl Sync for Tlock

impl Unpin for Tlock

impl UnwindSafe for Tlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tlopen

pub struct Tlopen {
    pub fid: u32,
    pub flags: u32,
}

lopen – open a file

size[4] Tlopen tag[2] fid[4] flags[4]
size[4] Rlopen tag[2] qid[13] iounit[4]

lopen prepares fid for file I/O. The flags field has the standard open(2) values.

Fields

fid: u32``flags: u32

Trait Implementations

impl Debug for Tlopen

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tlopen

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tlopen, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlopen

impl RefUnwindSafe for Tlopen

impl Send for Tlopen

impl Sync for Tlopen

impl Unpin for Tlopen

impl UnwindSafe for Tlopen

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tmkdir

pub struct Tmkdir {
    pub dfid: u32,
    pub name: String,
    pub mode: u32,
    pub gid: u32,
}

mkdir – create directory

size[4] Tmkdir tag[2] dfid[4] name[s] mode[4] gid[4]
size[4] Rmkdir tag[2] qid[13]

mkdir creates a new directory name in the directory represented by dfid.

Fields

dfid: u32``name: String``mode: u32``gid: u32

Trait Implementations

impl Debug for Tmkdir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tmkdir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tmkdir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tmkdir

impl RefUnwindSafe for Tmkdir

impl Send for Tmkdir

impl Sync for Tmkdir

impl Unpin for Tmkdir

impl UnwindSafe for Tmkdir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tmknod

pub struct Tmknod {
    pub dfid: u32,
    pub name: String,
    pub mode: u32,
    pub major: u32,
    pub minor: u32,
    pub gid: u32,
}

mknod – create a special file

size[4] Tmknod tag[2] dfid[4] name[s] mode[4] major[4] minor[4] gid[4]
size[4] Rmknod tag[2] qid[13]

mknod creates a new special file name in the directory represented by dfid.

Fields

dfid: u32``name: String``mode: u32``major: u32``minor: u32``gid: u32

Trait Implementations

impl Debug for Tmknod

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tmknod

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tmknod, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tmknod

impl RefUnwindSafe for Tmknod

impl Send for Tmknod

impl Sync for Tmknod

impl Unpin for Tmknod

impl UnwindSafe for Tmknod

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tread

pub struct Tread {
    pub fid: u32,
    pub offset: u64,
    pub count: u32,
}

read – read data from a file

size[4] Tread tag[2] fid[4] offset[8] count[4]
size[4] Rread tag[2] count[4] data[count]

read performs I/O on the file represented by fid.

Under 9P2000.L, read cannot be used on directories. See Treaddir for reading directories.

See the Plan 9 manual page for read(5).

Fields

fid: u32``offset: u64``count: u32

Trait Implementations

impl Debug for Tread

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tread

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tread, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tread

impl RefUnwindSafe for Tread

impl Send for Tread

impl Sync for Tread

impl Unpin for Tread

impl UnwindSafe for Tread

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Treaddir

pub struct Treaddir {
    pub fid: u32,
    pub offset: u64,
    pub count: u32,
}

readdir – read directory entries

size[4] Treaddir tag[2] fid[4] offset[8] count[4]
size[4] Rreaddir tag[2] count[4] data[count]

readdir reads directory entries from the directory represented by fid.

Fields

fid: u32``offset: u64``count: u32

Trait Implementations

impl Debug for Treaddir

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Treaddir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Treaddir, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Treaddir

impl RefUnwindSafe for Treaddir

impl Send for Treaddir

impl Sync for Treaddir

impl Unpin for Treaddir

impl UnwindSafe for Treaddir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Treadlink

pub struct Treadlink {
    pub fid: u32,
}

readlink – read symlink value

size[4] Treadlink tag[2] fid[4]
size[4] Rreadlink tag[2] target[s]

readlink reads the target of the symbolic link represented by fid.

Fields

fid: u32

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tremove

pub struct Tremove {
    pub fid: u32,
}

remove – remove a file

size[4] Tremove tag[2] fid[4]
size[4] Rremove tag[2]

remove removes the file represented by fid.

See the Plan 9 manual page for remove(5).

Fields

fid: u32

Trait Implementations

impl Debug for Tremove

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tremove

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tremove, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tremove

impl RefUnwindSafe for Tremove

impl Send for Tremove

impl Sync for Tremove

impl Unpin for Tremove

impl UnwindSafe for Tremove

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Trename

pub struct Trename {
    pub fid: u32,
    pub dfid: u32,
    pub name: String,
}

rename – rename a file

size[4] Trename tag[2] fid[4] dfid[4] name[s]
size[4] Rrename tag[2]

rename renames a file or directory from old name to new name in the directory represented by dfid. fid represents the file to be renamed.

Fields

fid: u32``dfid: u32``name: String

Trait Implementations

impl Debug for Trename

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Trename

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Trename, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Trename

impl RefUnwindSafe for Trename

impl Send for Trename

impl Sync for Trename

impl Unpin for Trename

impl UnwindSafe for Trename

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Trenameat

pub struct Trenameat {
    pub olddirfid: u32,
    pub oldname: String,
    pub newdirfid: u32,
    pub newname: String,
}

renameat – rename a file or directory

size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s]
size[4] Rrenameat tag[2]

renameat renames a file or directory from oldname in the directory represented by olddirfid to newname in the directory represented by newdirfid.

Fields

olddirfid: u32``oldname: String``newdirfid: u32``newname: String

Trait Implementations

impl Debug for Trenameat

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Trenameat

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Trenameat, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Trenameat

impl RefUnwindSafe for Trenameat

impl Send for Trenameat

impl Sync for Trenameat

impl Unpin for Trenameat

impl UnwindSafe for Trenameat

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tsetattr

pub struct Tsetattr {
    pub fid: u32,
    pub valid: u32,
    pub mode: u32,
    pub uid: u32,
    pub gid: u32,
    pub size: u64,
    pub atime_sec: u64,
    pub atime_nsec: u64,
    pub mtime_sec: u64,
    pub mtime_nsec: u64,
}

setattr – set file attributes

size[4] Tsetattr tag[2] fid[4] valid[4] mode[4] uid[4] gid[4] size[8]
    atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8]
size[4] Rsetattr tag[2]

setattr sets attributes of the file system object represented by fid.

Fields

fid: u32``valid: u32``mode: u32``uid: u32``gid: u32``size: u64``atime_sec: u64``atime_nsec: u64``mtime_sec: u64``mtime_nsec: u64

Trait Implementations

impl Debug for Tsetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tsetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tsetattr, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tsetattr

impl RefUnwindSafe for Tsetattr

impl Send for Tsetattr

impl Sync for Tsetattr

impl Unpin for Tsetattr

impl UnwindSafe for Tsetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tstatfs

pub struct Tstatfs {
    pub fid: u32,
}

statfs – get file system information

size[4] Tstatfs tag[2] fid[4]
size[4] Rstatfs tag[2] type[4] bsize[4] blocks[8] bfree[8] bavail[8]
                       files[8] ffree[8] fsid[8] namelen[4]

statfs is used to request file system information of the file system containing fid. The Rstatfs response corresponds to the fields returned by the statfs(2) system call.

Fields

fid: u32

Trait Implementations

impl Debug for Tstatfs

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tstatfs

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tstatfs, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tstatfs

impl RefUnwindSafe for Tstatfs

impl Send for Tstatfs

impl Sync for Tstatfs

impl Unpin for Tstatfs

impl UnwindSafe for Tstatfs

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tsymlink

pub struct Tsymlink {
    pub fid: u32,
    pub name: String,
    pub symtgt: String,
    pub gid: u32,
}

symlink – create symlink

size[4] Tsymlink tag[2] fid[4] name[s] symtgt[s] gid[4]
size[4] Rsymlink tag[2] qid[13]

symlink creates a new symbolic link name in the directory represented by fid.

Fields

fid: u32``name: String``symtgt: String``gid: u32

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tunlinkat

pub struct Tunlinkat {
    pub dirfd: u32,
    pub name: String,
    pub flags: u32,
}

unlinkat – unlink a file or directory

size[4] Tunlinkat tag[2] dirfd[4] name[s] flags[4]
size[4] Runlinkat tag[2]

unlinkat removes the file name from the directory represented by dirfd.

Fields

dirfd: u32``name: String``flags: u32

Trait Implementations

impl Debug for Tunlinkat

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tunlinkat

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tunlinkat, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tunlinkat

impl RefUnwindSafe for Tunlinkat

impl Send for Tunlinkat

impl Sync for Tunlinkat

impl Unpin for Tunlinkat

impl UnwindSafe for Tunlinkat

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Tversion

pub struct Tversion {
    pub msize: u32,
    pub version: String,
}

version – negotiate protocol version

size[4] Tversion tag[2] msize[4] version[s]
size[4] Rversion tag[2] msize[4] version[s]

version establishes the msize, which is the maximum message size inclusive of the size value that can be handled by both client and server.

It also establishes the protocol version. For 9P2000.L version must be the string 9P2000.L.

See the Plan 9 manual page for version(5).

Fields

msize: u32``version: String

Trait Implementations

impl Debug for Tversion

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Tversion

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Tversion, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tversion

impl RefUnwindSafe for Tversion

impl Send for Tversion

impl Sync for Tversion

impl Unpin for Tversion

impl UnwindSafe for Tversion

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Twalk

pub struct Twalk {
    pub fid: u32,
    pub newfid: u32,
    pub wnames: Vec<String>,
}

walk – descend a directory hierarchy

size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s])
size[4] Rwalk tag[2] nwqid[2] nwqid*(wqid[13])

walk is used to descend a directory represented by fid using successive path elements provided in the wname array. If successful, newfid represents the new path.

fid can be cloned to newfid by calling walk with nwname set to zero.

See the Plan 9 manual page for walk(5).

Fields

fid: u32``newfid: u32``wnames: Vec<String>

Trait Implementations

impl Debug for Twalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Twalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Twalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Twalk

impl RefUnwindSafe for Twalk

impl Send for Twalk

impl Sync for Twalk

impl Unpin for Twalk

impl UnwindSafe for Twalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Twrite

pub struct Twrite {
    pub fid: u32,
    pub offset: u64,
    pub data: Data,
}

write – write data to a file

size[4] Twrite tag[2] fid[4] offset[8] data[count]
size[4] Rwrite tag[2] count[4]

write performs I/O on the file represented by fid.

See the Plan 9 manual page for write(5).

Fields

fid: u32``offset: u64``data: Data

Trait Implementations

impl Debug for Twrite

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Twrite

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Twrite, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Twrite

impl RefUnwindSafe for Twrite

impl Send for Twrite

impl Sync for Twrite

impl Unpin for Twrite

impl UnwindSafe for Twrite

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Txattrcreate

pub struct Txattrcreate {
    pub fid: u32,
    pub name: String,
    pub attr_size: u64,
    pub flags: u32,
}

xattrcreate – create an extended attribute

size[4] Txattrcreate tag[2] fid[4] name[s] attr_size[8] flags[4]
size[4] Rxattrcreate tag[2]

xattrcreate creates a new extended attribute named name of the file represented by fid.

Fields

fid: u32``name: String``attr_size: u64``flags: u32

Trait Implementations

impl Debug for Txattrcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Txattrcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Txattrcreate, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Txattrcreate

impl RefUnwindSafe for Txattrcreate

impl Send for Txattrcreate

impl Sync for Txattrcreate

impl Unpin for Txattrcreate

impl UnwindSafe for Txattrcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::p9

Struct Txattrwalk

pub struct Txattrwalk {
    pub fid: u32,
    pub newfid: u32,
    pub name: String,
}

xattrwalk – walk extended attributes

size[4] Txattrwalk tag[2] fid[4] newfid[4] name[s]
size[4] Rxattrwalk tag[2] size[8]

xattrwalk gets a new fid pointing to the extended attribute directory of the file represented by fid.

Fields

fid: u32``newfid: u32``name: String

Trait Implementations

impl Debug for Txattrwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl WireFormat for Txattrwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(_reader: &mut R) -> Result<Txattrwalk, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Txattrwalk

impl RefUnwindSafe for Txattrwalk

impl Send for Txattrwalk

impl Sync for Txattrwalk

impl Unpin for Txattrwalk

impl UnwindSafe for Txattrwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude

Module server

Modules

Traits

  • Listener``Stream:

jetstream::prelude::server

Module proxy

jetstream::prelude::server

Module quic

jetstream::prelude::server

Module service

Structs

  • Server``Codec:

Functions

jetstream::prelude::server::service

Function run

pub async fn run<T, P>(
    p: &mut P,
    stream: T,
) -> Result<(), <P as Protocol>::Error>where
    T: ServiceTransport<P>,
    P: Protocol,

jetstream::prelude::server::service

Struct ServerCodec

pub struct ServerCodec<P>where
    P: Protocol,{ /* private fields */ }

Implementations

impl

ServerCodec

where P: Protocol,

pub fn new() -> ServerCodec

Trait Implementations

impl

Decoder for ServerCodec

where P: Protocol,

type Error = Error

The type of unrecoverable frame decoding errors. Read more

type Item = Frame<

::Request>

The type of decoded frames.

fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<<ServerCodec

as Decoder>::Item>, <ServerCodec

as Decoder>::Error>

Attempts to decode a frame from the provided buffer of bytes. Read more

fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more

fn framed(self, io: T) -> Framed<T, Self>where T: AsyncRead + AsyncWrite, Self: Sized,

Provides a Stream and Sink interface for reading and writing to thisIo object, using Decode and Encode to read and write the raw data. Read more

impl

Default for ServerCodec

where P: Protocol,

fn default() -> ServerCodec

Returns the “default value” for a type. Read more

impl

Encoder<Frame<

::Response>> for ServerCodec

where P: Protocol,

type Error = Error

The type of encoding errors. Read more

fn encode( &mut self, item: Frame<

::Response>, dst: &mut BytesMut, ) -> Result<(), <ServerCodec

as Encoder<Frame<

::Response>>>::Error>

Encodes a frame into the buffer provided. Read more

Auto Trait Implementations

impl

Freeze for ServerCodec

impl

RefUnwindSafe for ServerCodec

where P: RefUnwindSafe,

impl

Send for ServerCodec

impl

Sync for ServerCodec

impl

Unpin for ServerCodec

where P: Unpin,

impl

UnwindSafe for ServerCodec

where P: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude::server

Trait ListenerStream

pub trait ListenerStream:
    Send
    + Sync
    + Debug
    + 'static {
    type Stream: AsyncRead + AsyncWrite + Unpin + Send + Sync;
    type Addr: Debug;

    // Required method
    fn accept<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(Self::Stream, Self::Addr), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}

Required Associated Types

type Stream: AsyncRead + AsyncWrite + Unpin + Send + Sync

type Addr: Debug

Required Methods

fn accept<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(Self::Stream, Self::Addr), Error>> + Send + 'async_trait>>where 'life0: 'async_trait, Self: 'async_trait,

Implementations on Foreign Types

impl ListenerStream for UnixListener

type Stream = UnixStream

type Addr = SocketAddr

fn accept<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(::Stream, ::Addr), Error>> + Send + 'async_trait>>where 'life0: 'async_trait, UnixListener: 'async_trait,

Implementors

jetstream::prelude

Struct Data

#[repr(transparent)]pub struct Data(pub Vec<u8>);

A type that encodes an arbitrary number of bytes of data. Typically used for Rread Twrite messages. This differs from a Vec<u8> in that it encodes the number of bytes using a u32 instead of a u16.

Tuple Fields

0: Vec<u8>

Methods from Deref<Target = Vec>

1.0.0 ·

pub fn capacity(&self) -> usize

Returns the total number of elements the vector can hold without reallocating.

Examples
let mut vec: Vec<i32> = Vec::with_capacity(10);
vec.push(42);
assert!(vec.capacity() >= 10);

1.0.0 ·

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the given Vec<T>. The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1];
vec.reserve(10);
assert!(vec.capacity() >= 11);

1.0.0 ·

pub fn reserve_exact(&mut self, additional: usize)

Reserves the minimum capacity for at least additional more elements to be inserted in the given Vec<T>. Unlike reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling reserve_exact, capacity will be greater than or equal to self.len() + additional. Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1];
vec.reserve_exact(10);
assert!(vec.capacity() >= 11);

1.57.0 ·

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries to reserve capacity for at least additional more elements to be inserted in the given Vec<T>. The collection may reserve more space to speculatively avoid frequent reallocations. After calling try_reserve, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if capacity is already sufficient. This method preserves the contents even if an error occurs.

Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Examples
use std::collections::TryReserveError;

fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
    let mut output = Vec::new();

    // Pre-reserve the memory, exiting if we can't
    output.try_reserve(data.len())?;

    // Now we know this can't OOM in the middle of our complex work
    output.extend(data.iter().map(|&val| {
        val * 2 + 5 // very complicated
    }));

    Ok(output)
}

1.57.0 ·

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Tries to reserve the minimum capacity for at least additionalelements to be inserted in the given Vec<T>. Unlike try_reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling try_reserve_exact, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer try_reserve if future insertions are expected.

Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Examples
use std::collections::TryReserveError;

fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
    let mut output = Vec::new();

    // Pre-reserve the memory, exiting if we can't
    output.try_reserve_exact(data.len())?;

    // Now we know this can't OOM in the middle of our complex work
    output.extend(data.iter().map(|&val| {
        val * 2 + 5 // very complicated
    }));

    Ok(output)
}

1.0.0 ·

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the vector as much as possible.

The behavior of this method depends on the allocator, which may either shrink the vector in-place or reallocate. The resulting vector might still have some excess capacity, just as is the case for with_capacity. See Allocator::shrink for more details.

Examples
let mut vec = Vec::with_capacity(10);
vec.extend([1, 2, 3]);
assert!(vec.capacity() >= 10);
vec.shrink_to_fit();
assert!(vec.capacity() >= 3);

1.56.0 ·

pub fn shrink_to(&mut self, min_capacity: usize)

Shrinks the capacity of the vector with a lower bound.

The capacity will remain at least as large as both the length and the supplied value.

If the current capacity is less than the lower limit, this is a no-op.

Examples
let mut vec = Vec::with_capacity(10);
vec.extend([1, 2, 3]);
assert!(vec.capacity() >= 10);
vec.shrink_to(4);
assert!(vec.capacity() >= 4);
vec.shrink_to(0);
assert!(vec.capacity() >= 3);

1.0.0 ·

pub fn truncate(&mut self, len: usize)

Shortens the vector, keeping the first len elements and dropping the rest.

If len is greater or equal to the vector’s current length, this has no effect.

The drain method can emulate truncate, but causes the excess elements to be returned instead of dropped.

Note that this method has no effect on the allocated capacity of the vector.

Examples

Truncating a five element vector to two elements:

let mut vec = vec![1, 2, 3, 4, 5];
vec.truncate(2);
assert_eq!(vec, [1, 2]);

No truncation occurs when len is greater than the vector’s current length:

let mut vec = vec![1, 2, 3];
vec.truncate(8);
assert_eq!(vec, [1, 2, 3]);

Truncating when len == 0 is equivalent to calling the clearmethod.

let mut vec = vec![1, 2, 3];
vec.truncate(0);
assert_eq!(vec, []);

1.7.0 ·

pub fn as_slice(&self) -> &[T]

Extracts a slice containing the entire vector.

Equivalent to &s[..].

Examples
use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
io::sink().write(buffer.as_slice()).unwrap();

1.7.0 ·

pub fn as_mut_slice(&mut self) -> &mut [T]

Extracts a mutable slice of the entire vector.

Equivalent to &mut s[..].

Examples
use std::io::{self, Read};
let mut buffer = vec![0; 3];
io::repeat(0b101).read_exact(buffer.as_mut_slice()).unwrap();

1.37.0 ·

pub fn as_ptr(&self) -> *const T

Returns a raw pointer to the vector’s buffer, or a dangling raw pointer valid for zero sized reads if the vector didn’t allocate.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up dangling. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying slice, and thus the returned pointer will remain valid when mixed with other calls to as_ptr, as_mut_ptr, and as_non_null. Note that calling other methods that materialize mutable references to the slice, or mutable references to specific elements you are planning on accessing through this pointer, as well as writing to those elements, may still invalidate this pointer. See the second example below for how this guarantee can be used.

Examples
let x = vec![1, 2, 4];
let x_ptr = x.as_ptr();

unsafe {
    for i in 0..x.len() {
        assert_eq!(*x_ptr.add(i), 1 << i);
    }
}

Due to the aliasing guarantee, the following code is legal:

unsafe {
    let mut v = vec![0, 1, 2];
    let ptr1 = v.as_ptr();
    let _ = ptr1.read();
    let ptr2 = v.as_mut_ptr().offset(2);
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`
    // because it mutated a different element:
    let _ = ptr1.read();
}

1.37.0 ·

pub fn as_mut_ptr(&mut self) -> *mut T

Returns a raw mutable pointer to the vector’s buffer, or a dangling raw pointer valid for zero sized reads if the vector didn’t allocate.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up dangling. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying slice, and thus the returned pointer will remain valid when mixed with other calls to as_ptr, as_mut_ptr, and as_non_null. Note that calling other methods that materialize references to the slice, or references to specific elements you are planning on accessing through this pointer, may still invalidate this pointer. See the second example below for how this guarantee can be used.

Examples
// Allocate vector big enough for 4 elements.
let size = 4;
let mut x: Vec<i32> = Vec::with_capacity(size);
let x_ptr = x.as_mut_ptr();

// Initialize elements via raw pointer writes, then set length.
unsafe {
    for i in 0..size {
        *x_ptr.add(i) = i as i32;
    }
    x.set_len(size);
}
assert_eq!(&*x, &[0, 1, 2, 3]);

Due to the aliasing guarantee, the following code is legal:

unsafe {
    let mut v = vec![0];
    let ptr1 = v.as_mut_ptr();
    ptr1.write(1);
    let ptr2 = v.as_mut_ptr();
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
    ptr1.write(3);
}

pub fn as_non_null(&mut self) -> NonNull

🔬This is a nightly-only experimental API. (box_vec_non_null)

Returns a NonNull pointer to the vector’s buffer, or a dangling NonNull pointer valid for zero sized reads if the vector didn’t allocate.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up dangling. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying slice, and thus the returned pointer will remain valid when mixed with other calls to as_ptr, as_mut_ptr, and as_non_null. Note that calling other methods that materialize references to the slice, or references to specific elements you are planning on accessing through this pointer, may still invalidate this pointer. See the second example below for how this guarantee can be used.

Examples
#![feature(box_vec_non_null)]

// Allocate vector big enough for 4 elements.
let size = 4;
let mut x: Vec<i32> = Vec::with_capacity(size);
let x_ptr = x.as_non_null();

// Initialize elements via raw pointer writes, then set length.
unsafe {
    for i in 0..size {
        x_ptr.add(i).write(i as i32);
    }
    x.set_len(size);
}
assert_eq!(&*x, &[0, 1, 2, 3]);

Due to the aliasing guarantee, the following code is legal:

#![feature(box_vec_non_null)]

unsafe {
    let mut v = vec![0];
    let ptr1 = v.as_non_null();
    ptr1.write(1);
    let ptr2 = v.as_non_null();
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
    ptr1.write(3);
}

pub fn allocator(&self) -> &A

🔬This is a nightly-only experimental API. (allocator_api)

Returns a reference to the underlying allocator.1.0.0 ·

pub unsafe fn set_len(&mut self, new_len: usize)

Forces the length of the vector to new_len.

This is a low-level operation that maintains none of the normal invariants of the type. Normally changing the length of a vector is done using one of the safe operations instead, such as truncate, resize, extend, or clear.

Safety
  • new_len must be less than or equal to capacity().
  • The elements at old_len..new_len must be initialized.
Examples

This method can be useful for situations in which the vector is serving as a buffer for other code, particularly over FFI:

pub fn get_dictionary(&self) -> Option<Vec<u8>> {
    // Per the FFI method's docs, "32768 bytes is always enough".
    let mut dict = Vec::with_capacity(32_768);
    let mut dict_length = 0;
    // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that:
    // 1. `dict_length` elements were initialized.
    // 2. `dict_length` <= the capacity (32_768)
    // which makes `set_len` safe to call.
    unsafe {
        // Make the FFI call...
        let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);
        if r == Z_OK {
            // ...and update the length to what was initialized.
            dict.set_len(dict_length);
            Some(dict)
        } else {
            None
        }
    }
}

While the following example is sound, there is a memory leak since the inner vectors were not freed prior to the set_len call:

let mut vec = vec![vec![1, 0, 0],
                   vec![0, 1, 0],
                   vec![0, 0, 1]];
// SAFETY:
// 1. `old_len..0` is empty so no elements need to be initialized.
// 2. `0 <= capacity` always holds whatever `capacity` is.
unsafe {
    vec.set_len(0);
}

Normally, here, one would use clear instead to correctly drop the contents and thus not leak memory.1.0.0 ·

pub fn swap_remove(&mut self, index: usize) -> T

Removes an element from the vector and returns it.

The removed element is replaced by the last element of the vector.

This does not preserve ordering of the remaining elements, but is O(1). If you need to preserve the element order, use remove instead.

Panics

Panics if index is out of bounds.

Examples
let mut v = vec!["foo", "bar", "baz", "qux"];

assert_eq!(v.swap_remove(1), "bar");
assert_eq!(v, ["foo", "qux", "baz"]);

assert_eq!(v.swap_remove(0), "foo");
assert_eq!(v, ["baz", "qux"]);

1.0.0 ·

pub fn insert(&mut self, index: usize, element: T)

Inserts an element at position index within the vector, shifting all elements after it to the right.

Panics

Panics if index > len.

Examples
let mut vec = vec![1, 2, 3];
vec.insert(1, 4);
assert_eq!(vec, [1, 4, 2, 3]);
vec.insert(4, 5);
assert_eq!(vec, [1, 4, 2, 3, 5]);
Time complexity

Takes O( Vec::len) time. All items after the insertion index must be shifted to the right. In the worst case, all elements are shifted when the insertion index is 0.1.0.0 ·

pub fn remove(&mut self, index: usize) -> T

Removes and returns the element at position index within the vector, shifting all elements after it to the left.

Note: Because this shifts over the remaining elements, it has a worst-case performance of O( n). If you don’t need the order of elements to be preserved, use swap_remove instead. If you’d like to remove elements from the beginning of the Vec, consider using VecDeque::pop_front instead.

Panics

Panics if index is out of bounds.

Examples
let mut v = vec![1, 2, 3];
assert_eq!(v.remove(1), 2);
assert_eq!(v, [1, 3]);

1.0.0 ·

pub fn retain(&mut self, f: F)where F: FnMut(&T) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all elements e for which f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Examples
let mut vec = vec![1, 2, 3, 4];
vec.retain(|&x| x % 2 == 0);
assert_eq!(vec, [2, 4]);

Because the elements are visited exactly once in the original order, external state may be used to decide which elements to keep.

let mut vec = vec![1, 2, 3, 4, 5];
let keep = [false, true, true, false, true];
let mut iter = keep.iter();
vec.retain(|_| *iter.next().unwrap());
assert_eq!(vec, [2, 3, 5]);

1.61.0 ·

pub fn retain_mut(&mut self, f: F)where F: FnMut(&mut T) -> bool,

Retains only the elements specified by the predicate, passing a mutable reference to it.

In other words, remove all elements e such that f(&mut e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Examples
let mut vec = vec![1, 2, 3, 4];
vec.retain_mut(|x| if *x <= 3 {
    *x += 1;
    true
} else {
    false
});
assert_eq!(vec, [2, 3, 4]);

1.16.0 ·

pub fn dedup_by_key<F, K>(&mut self, key: F)where F: FnMut(&mut T) -> K, K: PartialEq,

Removes all but the first of consecutive elements in the vector that resolve to the same key.

If the vector is sorted, this removes all duplicates.

Examples
let mut vec = vec![10, 20, 21, 30, 20];

vec.dedup_by_key(|i| *i / 10);

assert_eq!(vec, [10, 20, 30, 20]);

1.16.0 ·

pub fn dedup_by(&mut self, same_bucket: F)where F: FnMut(&mut T, &mut T) -> bool,

Removes all but the first of consecutive elements in the vector satisfying a given equality relation.

The same_bucket function is passed references to two elements from the vector and must determine if the elements compare equal. The elements are passed in opposite order from their order in the slice, so if same_bucket(a, b) returns true, a is removed.

If the vector is sorted, this removes all duplicates.

Examples
let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];

vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));

assert_eq!(vec, ["foo", "bar", "baz", "bar"]);

1.0.0 ·

pub fn push(&mut self, value: T)

Appends an element to the back of a collection.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1, 2];
vec.push(3);
assert_eq!(vec, [1, 2, 3]);
Time complexity

Takes amortized O(1) time. If the vector’s length would exceed its capacity after the push, O( capacity) time is taken to copy the vector’s elements to a larger allocation. This expensive operation is offset by the capacity O(1) insertions it allows.

pub fn push_within_capacity(&mut self, value: T) -> Result<(), T>

🔬This is a nightly-only experimental API. (vec_push_within_capacity)

Appends an element if there is sufficient spare capacity, otherwise an error is returned with the element.

Unlike push this method will not reallocate when there’s insufficient capacity. The caller should use reserve or try_reserve to ensure that there is enough capacity.

Examples

A manual, panic-free alternative to FromIterator:

#![feature(vec_push_within_capacity)]

use std::collections::TryReserveError;
fn from_iter_fallible<T>(iter: impl Iterator<Item=T>) -> Result<Vec<T>, TryReserveError> {
    let mut vec = Vec::new();
    for value in iter {
        if let Err(value) = vec.push_within_capacity(value) {
            vec.try_reserve(1)?;
            // this cannot fail, the previous line either returned or added at least 1 free slot
            let _ = vec.push_within_capacity(value);
        }
    }
    Ok(vec)
}
assert_eq!(from_iter_fallible(0..100), Ok(Vec::from_iter(0..100)));
Time complexity

Takes O(1) time.1.0.0 ·

pub fn pop(&mut self) -> Option

Removes the last element from a vector and returns it, or None if it is empty.

If you’d like to pop the first element, consider using VecDeque::pop_front instead.

Examples
let mut vec = vec![1, 2, 3];
assert_eq!(vec.pop(), Some(3));
assert_eq!(vec, [1, 2]);
Time complexity

Takes O(1) time.

pub fn pop_if(&mut self, f: F) -> Optionwhere F: FnOnce(&mut T) -> bool,

🔬This is a nightly-only experimental API. (vec_pop_if)

Removes and returns the last element in a vector if the predicate returns true, or None if the predicate returns false or the vector is empty.

Examples
#![feature(vec_pop_if)]

let mut vec = vec![1, 2, 3, 4];
let pred = |x: &mut i32| *x % 2 == 0;

assert_eq!(vec.pop_if(pred), Some(4));
assert_eq!(vec, [1, 2, 3]);
assert_eq!(vec.pop_if(pred), None);

1.4.0 ·

pub fn append(&mut self, other: &mut Vec<T, A>)

Moves all the elements of other into self, leaving other empty.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1, 2, 3];
let mut vec2 = vec![4, 5, 6];
vec.append(&mut vec2);
assert_eq!(vec, [1, 2, 3, 4, 5, 6]);
assert_eq!(vec2, []);

1.6.0 ·

pub fn drain(&mut self, range: R) -> Drain<'_, T, A>where R: RangeBounds,

Removes the specified range from the vector in bulk, returning all removed elements as an iterator. If the iterator is dropped before being fully consumed, it drops the remaining removed elements.

The returned iterator keeps a mutable borrow on the vector to optimize its implementation.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Leaking

If the returned iterator goes out of scope without being dropped (due to mem::forget, for example), the vector may have lost and leaked elements arbitrarily, including elements outside the range.

Examples
let mut v = vec![1, 2, 3];
let u: Vec<_> = v.drain(1..).collect();
assert_eq!(v, &[1]);
assert_eq!(u, &[2, 3]);

// A full range clears the vector, like `clear()` does
v.drain(..);
assert_eq!(v, &[]);

1.0.0 ·

pub fn clear(&mut self)

Clears the vector, removing all values.

Note that this method has no effect on the allocated capacity of the vector.

Examples
let mut v = vec![1, 2, 3];

v.clear();

assert!(v.is_empty());

1.0.0 ·

pub fn len(&self) -> usize

Returns the number of elements in the vector, also referred to as its ‘length’.

Examples
let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);

1.0.0 ·

pub fn is_empty(&self) -> bool

Returns true if the vector contains no elements.

Examples
let mut v = Vec::new();
assert!(v.is_empty());

v.push(1);
assert!(!v.is_empty());

1.4.0 ·

pub fn split_off(&mut self, at: usize) -> Vec<T, A>where A: Clone,

Splits the collection into two at the given index.

Returns a newly allocated vector containing the elements in the range [at, len). After the call, the original vector will be left containing the elements [0, at) with its previous capacity unchanged.

  • If you want to take ownership of the entire contents and capacity of the vector, see mem::take or mem::replace.
  • If you don’t need the returned vector at all, see Vec::truncate.
  • If you want to take ownership of an arbitrary subslice, or you don’t necessarily want to store the removed items in a vector, see Vec::drain.
Panics

Panics if at > len.

Examples
let mut vec = vec![1, 2, 3];
let vec2 = vec.split_off(1);
assert_eq!(vec, [1]);
assert_eq!(vec2, [2, 3]);

1.33.0 ·

pub fn resize_with(&mut self, new_len: usize, f: F)where F: FnMut() -> T,

Resizes the Vec in-place so that len is equal to new_len.

If new_len is greater than len, the Vec is extended by the difference, with each additional slot filled with the result of calling the closure f. The return values from f will end up in the Vec in the order they have been generated.

If new_len is less than len, the Vec is simply truncated.

This method uses a closure to create new values on every push. If you’d rather Clone a given value, use Vec::resize. If you want to use the Default trait to generate values, you can pass Default::default as the second argument.

Examples
let mut vec = vec![1, 2, 3];
vec.resize_with(5, Default::default);
assert_eq!(vec, [1, 2, 3, 0, 0]);

let mut vec = vec![];
let mut p = 1;
vec.resize_with(4, || { p *= 2; p });
assert_eq!(vec, [2, 4, 8, 16]);

1.60.0 ·

pub fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit]

Returns the remaining spare capacity of the vector as a slice of MaybeUninit<T>.

The returned slice can be used to fill the vector with data (e.g. by reading from a file) before marking the data as initialized using the set_len method.

Examples
// Allocate vector big enough for 10 elements.
let mut v = Vec::with_capacity(10);

// Fill in the first 3 elements.
let uninit = v.spare_capacity_mut();
uninit[0].write(0);
uninit[1].write(1);
uninit[2].write(2);

// Mark the first 3 elements of the vector as being initialized.
unsafe {
    v.set_len(3);
}

assert_eq!(&v, &[0, 1, 2]);

pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit])

🔬This is a nightly-only experimental API. (vec_split_at_spare)

Returns vector content as a slice of T, along with the remaining spare capacity of the vector as a slice of MaybeUninit<T>.

The returned spare capacity slice can be used to fill the vector with data (e.g. by reading from a file) before marking the data as initialized using the set_len method.

Note that this is a low-level API, which should be used with care for optimization purposes. If you need to append data to a Vecyou can use push, extend, extend_from_slice, extend_from_within, insert, append, resize or resize_with, depending on your exact needs.

Examples
#![feature(vec_split_at_spare)]

let mut v = vec![1, 1, 2];

// Reserve additional space big enough for 10 elements.
v.reserve(10);

let (init, uninit) = v.split_at_spare_mut();
let sum = init.iter().copied().sum::<u32>();

// Fill in the next 4 elements.
uninit[0].write(sum);
uninit[1].write(sum * 2);
uninit[2].write(sum * 3);
uninit[3].write(sum * 4);

// Mark the 4 elements of the vector as being initialized.
unsafe {
    let len = v.len();
    v.set_len(len + 4);
}

assert_eq!(&v, &[1, 1, 2, 4, 8, 12, 16]);

1.5.0 ·

pub fn resize(&mut self, new_len: usize, value: T)

Resizes the Vec in-place so that len is equal to new_len.

If new_len is greater than len, the Vec is extended by the difference, with each additional slot filled with value. If new_len is less than len, the Vec is simply truncated.

This method requires T to implement Clone, in order to be able to clone the passed value. If you need more flexibility (or want to rely on Default instead of Clone), use Vec::resize_with. If you only need to resize to a smaller size, use Vec::truncate.

Examples
let mut vec = vec!["hello"];
vec.resize(3, "world");
assert_eq!(vec, ["hello", "world", "world"]);

let mut vec = vec![1, 2, 3, 4];
vec.resize(2, 0);
assert_eq!(vec, [1, 2]);

1.6.0 ·

pub fn extend_from_slice(&mut self, other: &[T])

Clones and appends all elements in a slice to the Vec.

Iterates over the slice other, clones each element, and then appends it to this Vec. The other slice is traversed in-order.

Note that this function is same as extend except that it is specialized to work with slices instead. If and when Rust gets specialization this function will likely be deprecated (but still available).

Examples
let mut vec = vec![1];
vec.extend_from_slice(&[2, 3, 4]);
assert_eq!(vec, [1, 2, 3, 4]);

1.53.0 ·

pub fn extend_from_within(&mut self, src: R)where R: RangeBounds,

Copies elements from src range to the end of the vector.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
let mut vec = vec![0, 1, 2, 3, 4];

vec.extend_from_within(2..);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4]);

vec.extend_from_within(..2);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1]);

vec.extend_from_within(4..8);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1, 4, 2, 3, 4]);

1.0.0 ·

pub fn dedup(&mut self)

Removes consecutive repeated elements in the vector according to the PartialEq trait implementation.

If the vector is sorted, this removes all duplicates.

Examples
let mut vec = vec![1, 2, 2, 3, 2];

vec.dedup();

assert_eq!(vec, [1, 2, 3, 2]);

1.21.0 ·

pub fn splice<R, I>( &mut self, range: R, replace_with: I, ) -> Splice<'_, ::IntoIter, A>where R: RangeBounds, I: IntoIterator<Item = T>,

Creates a splicing iterator that replaces the specified range in the vector with the given replace_with iterator and yields the removed items. replace_with does not need to be the same length as range.

range is removed even if the iterator is not consumed until the end.

It is unspecified how many elements are removed from the vector if the Splice value is leaked.

The input iterator replace_with is only consumed when the Splice value is dropped.

This is optimal if:

  • The tail (elements in the vector after range) is empty,
  • or replace_with yields fewer or equal elements than range’s length
  • or the lower bound of its size_hint() is exact.

Otherwise, a temporary vector is allocated and the tail is moved twice.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
let mut v = vec![1, 2, 3, 4];
let new = [7, 8, 9];
let u: Vec<_> = v.splice(1..3, new).collect();
assert_eq!(v, &[1, 7, 8, 9, 4]);
assert_eq!(u, &[2, 3]);

pub fn extract_if(&mut self, filter: F) -> ExtractIf<'_, T, F, A>where F: FnMut(&mut T) -> bool,

🔬This is a nightly-only experimental API. (extract_if)

Creates an iterator which uses a closure to determine if an element should be removed.

If the closure returns true, then the element is removed and yielded. If the closure returns false, the element will remain in the vector and will not be yielded by the iterator.

If the returned ExtractIf is not exhausted, e.g. because it is dropped without iterating or the iteration short-circuits, then the remaining elements will be retained. Use retain with a negated predicate if you do not need the returned iterator.

Using this method is equivalent to the following code:

let mut i = 0;
while i < vec.len() {
    if some_predicate(&mut vec[i]) {
        let val = vec.remove(i);
        // your code here
    } else {
        i += 1;
    }
}

But extract_if is easier to use. extract_if is also more efficient, because it can backshift the elements of the array in bulk.

Note that extract_if also lets you mutate every element in the filter closure, regardless of whether you choose to keep or remove it.

Examples

Splitting an array into evens and odds, reusing the original allocation:

#![feature(extract_if)]
let mut numbers = vec![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15];

let evens = numbers.extract_if(|x| *x % 2 == 0).collect::<Vec<_>>();
let odds = numbers;

assert_eq!(evens, vec![2, 4, 6, 8, 14]);
assert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]);

Methods from Deref<Target = [T]>

pub fn as_str(&self) -> &str

🔬This is a nightly-only experimental API. (ascii_char)

Views this slice of ASCII characters as a UTF-8 str.

pub fn as_bytes(&self) -> &[u8] ⓘ

🔬This is a nightly-only experimental API. (ascii_char)

Views this slice of ASCII characters as a slice of u8 bytes.1.23.0 ·

pub fn is_ascii(&self) -> bool

Checks if all bytes in this slice are within the ASCII range.

pub fn as_ascii(&self) -> Option<&[AsciiChar]>

🔬This is a nightly-only experimental API. (ascii_char)

If this slice is_ascii, returns it as a slice of ASCII characters, otherwise returns None.

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar]

🔬This is a nightly-only experimental API. (ascii_char)

Converts this slice of bytes into a slice of ASCII characters, without checking whether they’re valid.

Safety

Every byte in the slice must be in 0..=127, or else this is UB.1.23.0 ·

pub fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool

Checks that two slices are an ASCII case-insensitive match.

Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries.1.23.0 ·

pub fn make_ascii_uppercase(&mut self)

Converts this slice to its ASCII upper case equivalent in-place.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

To return a new uppercased value without modifying the existing one, use to_ascii_uppercase.1.23.0 ·

pub fn make_ascii_lowercase(&mut self)

Converts this slice to its ASCII lower case equivalent in-place.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

To return a new lowercased value without modifying the existing one, use to_ascii_lowercase.1.60.0 ·

pub fn escape_ascii(&self) -> EscapeAscii<'_>

Returns an iterator that produces an escaped version of this slice, treating it as an ASCII string.

Examples

let s = b"0\t\r\n'\"\\\x9d";
let escaped = s.escape_ascii().to_string();
assert_eq!(escaped, "0\\t\\r\\n\\'\\\"\\\\\\x9d");

1.80.0 ·

pub fn trim_ascii_start(&self) -> &[u8] ⓘ

Returns a byte slice with leading ASCII whitespace bytes removed.

‘Whitespace’ refers to the definition used by u8::is_ascii_whitespace.

Examples
assert_eq!(b" \t hello world\n".trim_ascii_start(), b"hello world\n");
assert_eq!(b"  ".trim_ascii_start(), b"");
assert_eq!(b"".trim_ascii_start(), b"");

1.80.0 ·

pub fn trim_ascii_end(&self) -> &[u8] ⓘ

Returns a byte slice with trailing ASCII whitespace bytes removed.

‘Whitespace’ refers to the definition used by u8::is_ascii_whitespace.

Examples
assert_eq!(b"\r hello world\n ".trim_ascii_end(), b"\r hello world");
assert_eq!(b"  ".trim_ascii_end(), b"");
assert_eq!(b"".trim_ascii_end(), b"");

1.80.0 ·

pub fn trim_ascii(&self) -> &[u8] ⓘ

Returns a byte slice with leading and trailing ASCII whitespace bytes removed.

‘Whitespace’ refers to the definition used by u8::is_ascii_whitespace.

Examples
assert_eq!(b"\r hello world\n ".trim_ascii(), b"hello world");
assert_eq!(b"  ".trim_ascii(), b"");
assert_eq!(b"".trim_ascii(), b"");

1.0.0 ·

pub fn len(&self) -> usize

Returns the number of elements in the slice.

Examples
let a = [1, 2, 3];
assert_eq!(a.len(), 3);

1.0.0 ·

pub fn is_empty(&self) -> bool

Returns true if the slice has a length of 0.

Examples
let a = [1, 2, 3];
assert!(!a.is_empty());

let b: &[i32] = &[];
assert!(b.is_empty());

1.0.0 ·

pub fn first(&self) -> Option<&T>

Returns the first element of the slice, or None if it is empty.

Examples
let v = [10, 40, 30];
assert_eq!(Some(&10), v.first());

let w: &[i32] = &[];
assert_eq!(None, w.first());

1.0.0 ·

pub fn first_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the first element of the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some(first) = x.first_mut() {
    *first = 5;
}
assert_eq!(x, &[5, 1, 2]);

let y: &mut [i32] = &mut [];
assert_eq!(None, y.first_mut());

1.5.0 ·

pub fn split_first(&self) -> Option<(&T, &[T])>

Returns the first and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &[0, 1, 2];

if let Some((first, elements)) = x.split_first() {
    assert_eq!(first, &0);
    assert_eq!(elements, &[1, 2]);
}

1.5.0 ·

pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])>

Returns the first and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some((first, elements)) = x.split_first_mut() {
    *first = 3;
    elements[0] = 4;
    elements[1] = 5;
}
assert_eq!(x, &[3, 4, 5]);

1.5.0 ·

pub fn split_last(&self) -> Option<(&T, &[T])>

Returns the last and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &[0, 1, 2];

if let Some((last, elements)) = x.split_last() {
    assert_eq!(last, &2);
    assert_eq!(elements, &[0, 1]);
}

1.5.0 ·

pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])>

Returns the last and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some((last, elements)) = x.split_last_mut() {
    *last = 3;
    elements[0] = 4;
    elements[1] = 5;
}
assert_eq!(x, &[4, 5, 3]);

1.0.0 ·

pub fn last(&self) -> Option<&T>

Returns the last element of the slice, or None if it is empty.

Examples
let v = [10, 40, 30];
assert_eq!(Some(&30), v.last());

let w: &[i32] = &[];
assert_eq!(None, w.last());

1.0.0 ·

pub fn last_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the last item in the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some(last) = x.last_mut() {
    *last = 10;
}
assert_eq!(x, &[0, 1, 10]);

let y: &mut [i32] = &mut [];
assert_eq!(None, y.last_mut());

1.77.0 ·

pub fn first_chunk(&self) -> Option<&[T; N]>

Returns an array reference to the first N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let u = [10, 40, 30];
assert_eq!(Some(&[10, 40]), u.first_chunk::<2>());

let v: &[i32] = &[10];
assert_eq!(None, v.first_chunk::<2>());

let w: &[i32] = &[];
assert_eq!(Some(&[]), w.first_chunk::<0>());

1.77.0 ·

pub fn first_chunk_mut(&mut self) -> Option<&mut [T; N]>

Returns a mutable array reference to the first N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some(first) = x.first_chunk_mut::<2>() {
    first[0] = 5;
    first[1] = 4;
}
assert_eq!(x, &[5, 4, 2]);

assert_eq!(None, x.first_chunk_mut::<4>());

1.77.0 ·

pub fn split_first_chunk(&self) -> Option<(&[T; N], &[T])>

Returns an array reference to the first N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &[0, 1, 2];

if let Some((first, elements)) = x.split_first_chunk::<2>() {
    assert_eq!(first, &[0, 1]);
    assert_eq!(elements, &[2]);
}

assert_eq!(None, x.split_first_chunk::<4>());

1.77.0 ·

pub fn split_first_chunk_mut( &mut self, ) -> Option<(&mut [T; N], &mut [T])>

Returns a mutable array reference to the first N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some((first, elements)) = x.split_first_chunk_mut::<2>() {
    first[0] = 3;
    first[1] = 4;
    elements[0] = 5;
}
assert_eq!(x, &[3, 4, 5]);

assert_eq!(None, x.split_first_chunk_mut::<4>());

1.77.0 ·

pub fn split_last_chunk(&self) -> Option<(&[T], &[T; N])>

Returns an array reference to the last N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &[0, 1, 2];

if let Some((elements, last)) = x.split_last_chunk::<2>() {
    assert_eq!(elements, &[0]);
    assert_eq!(last, &[1, 2]);
}

assert_eq!(None, x.split_last_chunk::<4>());

1.77.0 ·

pub fn split_last_chunk_mut( &mut self, ) -> Option<(&mut [T], &mut [T; N])>

Returns a mutable array reference to the last N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some((elements, last)) = x.split_last_chunk_mut::<2>() {
    last[0] = 3;
    last[1] = 4;
    elements[0] = 5;
}
assert_eq!(x, &[5, 3, 4]);

assert_eq!(None, x.split_last_chunk_mut::<4>());

1.77.0 ·

pub fn last_chunk(&self) -> Option<&[T; N]>

Returns an array reference to the last N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let u = [10, 40, 30];
assert_eq!(Some(&[40, 30]), u.last_chunk::<2>());

let v: &[i32] = &[10];
assert_eq!(None, v.last_chunk::<2>());

let w: &[i32] = &[];
assert_eq!(Some(&[]), w.last_chunk::<0>());

1.77.0 ·

pub fn last_chunk_mut(&mut self) -> Option<&mut [T; N]>

Returns a mutable array reference to the last N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some(last) = x.last_chunk_mut::<2>() {
    last[0] = 10;
    last[1] = 20;
}
assert_eq!(x, &[0, 10, 20]);

assert_eq!(None, x.last_chunk_mut::<4>());

1.0.0 ·

pub fn get(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output>where I: SliceIndex<[T]>,

Returns a reference to an element or subslice depending on the type of index.

  • If given a position, returns a reference to the element at that position or None if out of bounds.
  • If given a range, returns the subslice corresponding to that range, or None if out of bounds.
Examples
let v = [10, 40, 30];
assert_eq!(Some(&40), v.get(1));
assert_eq!(Some(&[10, 40][..]), v.get(0..2));
assert_eq!(None, v.get(3));
assert_eq!(None, v.get(0..4));

1.0.0 ·

pub fn get_mut( &mut self, index: I, ) -> Option<&mut <I as SliceIndex<[T]>>::Output>where I: SliceIndex<[T]>,

Returns a mutable reference to an element or subslice depending on the type of index (see get) or None if the index is out of bounds.

Examples
let x = &mut [0, 1, 2];

if let Some(elem) = x.get_mut(1) {
    *elem = 42;
}
assert_eq!(x, &[0, 42, 2]);

1.0.0 ·

pub unsafe fn get_unchecked( &self, index: I, ) -> &<I as SliceIndex<[T]>>::Outputwhere I: SliceIndex<[T]>,

Returns a reference to an element or subslice, without doing bounds checking.

For a safe alternative see get.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used.

You can think of this like .get(index).unwrap_unchecked(). It’s UB to call .get_unchecked(len), even if you immediately convert to a pointer. And it’s UB to call .get_unchecked(..len + 1), .get_unchecked(..=len), or similar.

Examples
let x = &[1, 2, 4];

unsafe {
    assert_eq!(x.get_unchecked(1), &2);
}

1.0.0 ·

pub unsafe fn get_unchecked_mut( &mut self, index: I, ) -> &mut <I as SliceIndex<[T]>>::Outputwhere I: SliceIndex<[T]>,

Returns a mutable reference to an element or subslice, without doing bounds checking.

For a safe alternative see get_mut.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used.

You can think of this like .get_mut(index).unwrap_unchecked(). It’s UB to call .get_unchecked_mut(len), even if you immediately convert to a pointer. And it’s UB to call .get_unchecked_mut(..len + 1), .get_unchecked_mut(..=len), or similar.

Examples
let x = &mut [1, 2, 4];

unsafe {
    let elem = x.get_unchecked_mut(1);
    *elem = 13;
}
assert_eq!(x, &[1, 13, 4]);

1.0.0 ·

pub fn as_ptr(&self) -> *const T

Returns a raw pointer to the slice’s buffer.

The caller must ensure that the slice outlives the pointer this function returns, or else it will end up dangling.

The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.

Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.

Examples
let x = &[1, 2, 4];
let x_ptr = x.as_ptr();

unsafe {
    for i in 0..x.len() {
        assert_eq!(x.get_unchecked(i), &*x_ptr.add(i));
    }
}

1.0.0 ·

pub fn as_mut_ptr(&mut self) -> *mut T

Returns an unsafe mutable pointer to the slice’s buffer.

The caller must ensure that the slice outlives the pointer this function returns, or else it will end up dangling.

Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.

Examples
let x = &mut [1, 2, 4];
let x_ptr = x.as_mut_ptr();

unsafe {
    for i in 0..x.len() {
        *x_ptr.add(i) += 2;
    }
}
assert_eq!(x, &[3, 4, 6]);

1.48.0 ·

pub fn as_ptr_range(&self) -> Range<*const T>

Returns the two raw pointers spanning the slice.

The returned range is half-open, which means that the end pointer points one past the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.

See as_ptr for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.

This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.

It can also be useful to check if a pointer to an element refers to an element of this slice:

let a = [1, 2, 3];
let x = &a[1] as *const _;
let y = &5 as *const _;

assert!(a.as_ptr_range().contains(&x));
assert!(!a.as_ptr_range().contains(&y));

1.48.0 ·

pub fn as_mut_ptr_range(&mut self) -> Range<*mut T>

Returns the two unsafe mutable pointers spanning the slice.

The returned range is half-open, which means that the end pointer points one past the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.

See as_mut_ptr for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.

This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.1.0.0 ·

pub fn swap(&mut self, a: usize, b: usize)

Swaps two elements in the slice.

If a equals to b, it’s guaranteed that elements won’t change value.

Arguments
  • a - The index of the first element
  • b - The index of the second element
Panics

Panics if a or b are out of bounds.

Examples
let mut v = ["a", "b", "c", "d", "e"];
v.swap(2, 4);
assert!(v == ["a", "b", "e", "d", "c"]);

pub unsafe fn swap_unchecked(&mut self, a: usize, b: usize)

🔬This is a nightly-only experimental API. (slice_swap_unchecked)

Swaps two elements in the slice, without doing bounds checking.

For a safe alternative see swap.

Arguments
  • a - The index of the first element
  • b - The index of the second element
Safety

Calling this method with an out-of-bounds index is undefined behavior. The caller has to ensure that a < self.len() and b < self.len().

Examples
#![feature(slice_swap_unchecked)]

let mut v = ["a", "b", "c", "d"];
// SAFETY: we know that 1 and 3 are both indices of the slice
unsafe { v.swap_unchecked(1, 3) };
assert!(v == ["a", "d", "c", "b"]);

1.0.0 ·

pub fn reverse(&mut self)

Reverses the order of elements in the slice, in place.

Examples
let mut v = [1, 2, 3];
v.reverse();
assert!(v == [3, 2, 1]);

1.0.0 ·

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the slice.

The iterator yields all items from start to end.

Examples
let x = &[1, 2, 4];
let mut iterator = x.iter();

assert_eq!(iterator.next(), Some(&1));
assert_eq!(iterator.next(), Some(&2));
assert_eq!(iterator.next(), Some(&4));
assert_eq!(iterator.next(), None);

1.0.0 ·

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns an iterator that allows modifying each value.

The iterator yields all items from start to end.

Examples
let x = &mut [1, 2, 4];
for elem in x.iter_mut() {
    *elem += 2;
}
assert_eq!(x, &[3, 4, 6]);

1.0.0 ·

pub fn windows(&self, size: usize) -> Windows<'_, T>

Returns an iterator over all contiguous windows of length size. The windows overlap. If the slice is shorter than size, the iterator returns no values.

Panics

Panics if size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.windows(3);
assert_eq!(iter.next().unwrap(), &['l', 'o', 'r']);
assert_eq!(iter.next().unwrap(), &['o', 'r', 'e']);
assert_eq!(iter.next().unwrap(), &['r', 'e', 'm']);
assert!(iter.next().is_none());

If the slice is shorter than size:

let slice = ['f', 'o', 'o'];
let mut iter = slice.windows(4);
assert!(iter.next().is_none());

There’s no windows_mut, as that existing would let safe code violate the “only one &mut at a time to the same thing” rule. However, you can sometimes use Cell::as_slice_of_cells in conjunction with windows to accomplish something similar:

use std::cell::Cell;

let mut array = ['R', 'u', 's', 't', ' ', '2', '0', '1', '5'];
let slice = &mut array[..];
let slice_of_cells: &[Cell<char>] = Cell::from_mut(slice).as_slice_of_cells();
for w in slice_of_cells.windows(3) {
    Cell::swap(&w[0], &w[2]);
}
assert_eq!(array, ['s', 't', ' ', '2', '0', '1', '5', 'u', 'R']);

1.0.0 ·

pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See chunks_exact for a variant of this iterator that returns chunks of always exactly chunk_size elements, and rchunks for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert_eq!(iter.next().unwrap(), &['m']);
assert!(iter.next().is_none());

1.0.0 ·

pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See chunks_exact_mut for a variant of this iterator that returns chunks of always exactly chunk_size elements, and rchunks_mut for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.chunks_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 3]);

1.31.0 ·

pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of chunks.

See chunks for a variant of this iterator that also returns the remainder as a smaller chunk, and rchunks_exact for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks_exact(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);

1.31.0 ·

pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the into_remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of chunks_mut.

See chunks_mut for a variant of this iterator that also returns the remainder as a smaller chunk, and rchunks_exact_mut for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.chunks_exact_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 0]);

pub unsafe fn as_chunks_unchecked(&self) -> &[[T; N]]

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, assuming that there’s no remainder.

Safety

This may only be called when

  • The slice splits exactly into N-element chunks (aka self.len() % N == 0).
  • N != 0.
Examples
#![feature(slice_as_chunks)]
let slice: &[char] = &['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &[[char; 1]] =
    // SAFETY: 1-element chunks never have remainder
    unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &[[char; 3]] =
    // SAFETY: The slice length (6) is a multiple of 3
    unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l', 'o', 'r'], ['e', 'm', '!']]);

// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed

pub fn as_chunks(&self) -> (&[[T; N]], &[T])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (chunks, remainder) = slice.as_chunks();
assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
assert_eq!(remainder, &['m']);

If you expect the slice to be an exact multiple, you can combine let- else with an empty slice pattern:

#![feature(slice_as_chunks)]
let slice = ['R', 'u', 's', 't'];
let (chunks, []) = slice.as_chunks::<2>() else {
    panic!("slice didn't have even length")
};
assert_eq!(chunks, &[['R', 'u'], ['s', 't']]);

pub fn as_rchunks(&self) -> (&[T], &[[T; N]])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (remainder, chunks) = slice.as_rchunks();
assert_eq!(remainder, &['l']);
assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]);

pub fn array_chunks(&self) -> ArrayChunks<'_, T, N>

🔬This is a nightly-only experimental API. (array_chunks)

Returns an iterator over N elements of the slice at a time, starting at the beginning of the slice.

The chunks are array references and do not overlap. If N does not divide the length of the slice, then the last up to N-1 elements will be omitted and can be retrieved from the remainder function of the iterator.

This method is the const generic equivalent of chunks_exact.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(array_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.array_chunks();
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);

pub unsafe fn as_chunks_unchecked_mut( &mut self, ) -> &mut [[T; N]]

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, assuming that there’s no remainder.

Safety

This may only be called when

  • The slice splits exactly into N-element chunks (aka self.len() % N == 0).
  • N != 0.
Examples
#![feature(slice_as_chunks)]
let slice: &mut [char] = &mut ['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &mut [[char; 1]] =
    // SAFETY: 1-element chunks never have remainder
    unsafe { slice.as_chunks_unchecked_mut() };
chunks[0] = ['L'];
assert_eq!(chunks, &[['L'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &mut [[char; 3]] =
    // SAFETY: The slice length (6) is a multiple of 3
    unsafe { slice.as_chunks_unchecked_mut() };
chunks[1] = ['a', 'x', '?'];
assert_eq!(slice, &['L', 'o', 'r', 'a', 'x', '?']);

// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed

pub fn as_chunks_mut(&mut self) -> (&mut [[T; N]], &mut [T])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

let (chunks, remainder) = v.as_chunks_mut();
remainder[0] = 9;
for chunk in chunks {
    *chunk = [count; 2];
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 9]);

pub fn as_rchunks_mut(&mut self) -> (&mut [T], &mut [[T; N]])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

let (remainder, chunks) = v.as_rchunks_mut();
remainder[0] = 9;
for chunk in chunks {
    *chunk = [count; 2];
    count += 1;
}
assert_eq!(v, &[9, 1, 1, 2, 2]);

pub fn array_chunks_mut(&mut self) -> ArrayChunksMut<'_, T, N>

🔬This is a nightly-only experimental API. (array_chunks)

Returns an iterator over N elements of the slice at a time, starting at the beginning of the slice.

The chunks are mutable array references and do not overlap. If N does not divide the length of the slice, then the last up to N-1 elements will be omitted and can be retrieved from the into_remainder function of the iterator.

This method is the const generic equivalent of chunks_exact_mut.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(array_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.array_chunks_mut() {
    *chunk = [count; 2];
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 0]);

pub fn array_windows(&self) -> ArrayWindows<'_, T, N>

🔬This is a nightly-only experimental API. (array_windows)

Returns an iterator over overlapping windows of N elements of a slice, starting at the beginning of the slice.

This is the const generic equivalent of windows.

If N is greater than the size of the slice, it will return no windows.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(array_windows)]
let slice = [0, 1, 2, 3];
let mut iter = slice.array_windows();
assert_eq!(iter.next().unwrap(), &[0, 1]);
assert_eq!(iter.next().unwrap(), &[1, 2]);
assert_eq!(iter.next().unwrap(), &[2, 3]);
assert!(iter.next().is_none());

1.31.0 ·

pub fn rchunks(&self, chunk_size: usize) -> RChunks<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See rchunks_exact for a variant of this iterator that returns chunks of always exactly chunk_size elements, and chunks for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert_eq!(iter.next().unwrap(), &['l']);
assert!(iter.next().is_none());

1.31.0 ·

pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See rchunks_exact_mut for a variant of this iterator that returns chunks of always exactly chunk_size elements, and chunks_mut for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.rchunks_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[3, 2, 2, 1, 1]);

1.31.0 ·

pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of rchunks.

See rchunks for a variant of this iterator that also returns the remainder as a smaller chunk, and chunks_exact for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks_exact(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['l']);

1.31.0 ·

pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the into_remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of chunks_mut.

See rchunks_mut for a variant of this iterator that also returns the remainder as a smaller chunk, and chunks_exact_mut for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.rchunks_exact_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[0, 2, 2, 1, 1]);

1.77.0 ·

pub fn chunk_by(&self, pred: F) -> ChunkBy<'_, T, F>where F: FnMut(&T, &T) -> bool,

Returns an iterator over the slice producing non-overlapping runs of elements using the predicate to separate them.

The predicate is called for every pair of consecutive elements, meaning that it is called on slice[0] and slice[1], followed by slice[1] and slice[2], and so on.

Examples
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];

let mut iter = slice.chunk_by(|a, b| a == b);

assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);

This method can be used to extract the sorted subslices:

let slice = &[1, 1, 2, 3, 2, 3, 2, 3, 4];

let mut iter = slice.chunk_by(|a, b| a <= b);

assert_eq!(iter.next(), Some(&[1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3, 4][..]));
assert_eq!(iter.next(), None);

1.77.0 ·

pub fn chunk_by_mut(&mut self, pred: F) -> ChunkByMut<'_, T, F>where F: FnMut(&T, &T) -> bool,

Returns an iterator over the slice producing non-overlapping mutable runs of elements using the predicate to separate them.

The predicate is called for every pair of consecutive elements, meaning that it is called on slice[0] and slice[1], followed by slice[1] and slice[2], and so on.

Examples
let slice = &mut [1, 1, 1, 3, 3, 2, 2, 2];

let mut iter = slice.chunk_by_mut(|a, b| a == b);

assert_eq!(iter.next(), Some(&mut [1, 1, 1][..]));
assert_eq!(iter.next(), Some(&mut [3, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 2, 2][..]));
assert_eq!(iter.next(), None);

This method can be used to extract the sorted subslices:

let slice = &mut [1, 1, 2, 3, 2, 3, 2, 3, 4];

let mut iter = slice.chunk_by_mut(|a, b| a <= b);

assert_eq!(iter.next(), Some(&mut [1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 3, 4][..]));
assert_eq!(iter.next(), None);

1.0.0 ·

pub fn split_at(&self, mid: usize) -> (&[T], &[T])

Divides one slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Panics

Panics if mid > len. For a non-panicking alternative see split_at_checked.

Examples
let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.split_at(0);
   assert_eq!(left, []);
   assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}

{
    let (left, right) = v.split_at(2);
    assert_eq!(left, [1, 2]);
    assert_eq!(right, [3, 4, 5, 6]);
}

{
    let (left, right) = v.split_at(6);
    assert_eq!(left, [1, 2, 3, 4, 5, 6]);
    assert_eq!(right, []);
}

1.0.0 ·

pub fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T])

Divides one mutable slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Panics

Panics if mid > len. For a non-panicking alternative see split_at_mut_checked.

Examples
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_at_mut(2);
assert_eq!(left, [1, 0]);
assert_eq!(right, [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

1.79.0 ·

pub unsafe fn split_at_unchecked(&self, mid: usize) -> (&[T], &[T])

Divides one slice into two at an index, without doing bounds checking.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

For a safe alternative see split_at.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used. The caller has to ensure that 0 <= mid <= self.len().

Examples
let v = [1, 2, 3, 4, 5, 6];

unsafe {
   let (left, right) = v.split_at_unchecked(0);
   assert_eq!(left, []);
   assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}

unsafe {
    let (left, right) = v.split_at_unchecked(2);
    assert_eq!(left, [1, 2]);
    assert_eq!(right, [3, 4, 5, 6]);
}

unsafe {
    let (left, right) = v.split_at_unchecked(6);
    assert_eq!(left, [1, 2, 3, 4, 5, 6]);
    assert_eq!(right, []);
}

1.79.0 ·

pub unsafe fn split_at_mut_unchecked( &mut self, mid: usize, ) -> (&mut [T], &mut [T])

Divides one mutable slice into two at an index, without doing bounds checking.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

For a safe alternative see split_at_mut.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used. The caller has to ensure that 0 <= mid <= self.len().

Examples
let mut v = [1, 0, 3, 0, 5, 6];
// scoped to restrict the lifetime of the borrows
unsafe {
    let (left, right) = v.split_at_mut_unchecked(2);
    assert_eq!(left, [1, 0]);
    assert_eq!(right, [3, 0, 5, 6]);
    left[1] = 2;
    right[1] = 4;
}
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

1.80.0 ·

pub fn split_at_checked(&self, mid: usize) -> Option<(&[T], &[T])>

Divides one slice into two at an index, returning None if the slice is too short.

If mid ≤ len returns a pair of slices where the first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Otherwise, if mid > len, returns None.

Examples
let v = [1, -2, 3, -4, 5, -6];

{
   let (left, right) = v.split_at_checked(0).unwrap();
   assert_eq!(left, []);
   assert_eq!(right, [1, -2, 3, -4, 5, -6]);
}

{
    let (left, right) = v.split_at_checked(2).unwrap();
    assert_eq!(left, [1, -2]);
    assert_eq!(right, [3, -4, 5, -6]);
}

{
    let (left, right) = v.split_at_checked(6).unwrap();
    assert_eq!(left, [1, -2, 3, -4, 5, -6]);
    assert_eq!(right, []);
}

assert_eq!(None, v.split_at_checked(7));

1.80.0 ·

pub fn split_at_mut_checked( &mut self, mid: usize, ) -> Option<(&mut [T], &mut [T])>

Divides one mutable slice into two at an index, returning None if the slice is too short.

If mid ≤ len returns a pair of slices where the first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Otherwise, if mid > len, returns None.

Examples
let mut v = [1, 0, 3, 0, 5, 6];

if let Some((left, right)) = v.split_at_mut_checked(2) {
    assert_eq!(left, [1, 0]);
    assert_eq!(right, [3, 0, 5, 6]);
    left[1] = 2;
    right[1] = 4;
}
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

assert_eq!(None, v.split_at_mut_checked(7));

1.0.0 ·

pub fn split(&self, pred: F) -> Split<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred. The matched element is not contained in the subslices.

Examples
let slice = [10, 40, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());

If the first element is matched, an empty slice will be the first item returned by the iterator. Similarly, if the last element in the slice is matched, an empty slice will be the last item returned by the iterator:

let slice = [10, 40, 33];
let mut iter = slice.split(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[]);
assert!(iter.next().is_none());

If two matched elements are directly adjacent, an empty slice will be present between them:

let slice = [10, 6, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10]);
assert_eq!(iter.next().unwrap(), &[]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());

1.0.0 ·

pub fn split_mut(&mut self, pred: F) -> SplitMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred. The matched element is not contained in the subslices.

Examples
let mut v = [10, 40, 30, 20, 60, 50];

for group in v.split_mut(|num| *num % 3 == 0) {
    group[0] = 1;
}
assert_eq!(v, [1, 40, 30, 1, 60, 1]);

1.51.0 ·

pub fn split_inclusive(&self, pred: F) -> SplitInclusive<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred. The matched element is contained in the end of the previous subslice as a terminator.

Examples
let slice = [10, 40, 33, 20];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());

If the last element of the slice is matched, that element will be considered the terminator of the preceding slice. That slice will be the last item returned by the iterator.

let slice = [3, 10, 40, 33];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[3]);
assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert!(iter.next().is_none());

1.51.0 ·

pub fn split_inclusive_mut(&mut self, pred: F) -> SplitInclusiveMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred. The matched element is contained in the previous subslice as a terminator.

Examples
let mut v = [10, 40, 30, 20, 60, 50];

for group in v.split_inclusive_mut(|num| *num % 3 == 0) {
    let terminator_idx = group.len()-1;
    group[terminator_idx] = 1;
}
assert_eq!(v, [10, 40, 1, 20, 1, 1]);

1.27.0 ·

pub fn rsplit(&self, pred: F) -> RSplit<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.

Examples
let slice = [11, 22, 33, 0, 44, 55];
let mut iter = slice.rsplit(|num| *num == 0);

assert_eq!(iter.next().unwrap(), &[44, 55]);
assert_eq!(iter.next().unwrap(), &[11, 22, 33]);
assert_eq!(iter.next(), None);

As with split(), if the first or last element is matched, an empty slice will be the first (or last) item returned by the iterator.

let v = &[0, 1, 1, 2, 3, 5, 8];
let mut it = v.rsplit(|n| *n % 2 == 0);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next().unwrap(), &[3, 5]);
assert_eq!(it.next().unwrap(), &[1, 1]);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next(), None);

1.27.0 ·

pub fn rsplit_mut(&mut self, pred: F) -> RSplitMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.

Examples
let mut v = [100, 400, 300, 200, 600, 500];

let mut count = 0;
for group in v.rsplit_mut(|num| *num % 3 == 0) {
    count += 1;
    group[0] = count;
}
assert_eq!(v, [3, 400, 300, 2, 600, 1]);

1.0.0 ·

pub fn splitn(&self, n: usize, pred: F) -> SplitN<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples

Print the slice split once by numbers divisible by 3 (i.e., [10, 40], [20, 60, 50]):

let v = [10, 40, 30, 20, 60, 50];

for group in v.splitn(2, |num| *num % 3 == 0) {
    println!("{group:?}");
}

1.0.0 ·

pub fn splitn_mut(&mut self, n: usize, pred: F) -> SplitNMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples
let mut v = [10, 40, 30, 20, 60, 50];

for group in v.splitn_mut(2, |num| *num % 3 == 0) {
    group[0] = 1;
}
assert_eq!(v, [1, 40, 30, 1, 60, 50]);

1.0.0 ·

pub fn rsplitn(&self, n: usize, pred: F) -> RSplitN<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples

Print the slice split once, starting from the end, by numbers divisible by 3 (i.e., [50], [10, 40, 30, 20]):

let v = [10, 40, 30, 20, 60, 50];

for group in v.rsplitn(2, |num| *num % 3 == 0) {
    println!("{group:?}");
}

1.0.0 ·

pub fn rsplitn_mut(&mut self, n: usize, pred: F) -> RSplitNMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples
let mut s = [10, 40, 30, 20, 60, 50];

for group in s.rsplitn_mut(2, |num| *num % 3 == 0) {
    group[0] = 1;
}
assert_eq!(s, [1, 40, 30, 20, 60, 1]);

pub fn split_once(&self, pred: F) -> Option<(&[T], &[T])>where F: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (slice_split_once)

Splits the slice on the first element that matches the specified predicate.

If any matching elements are present in the slice, returns the prefix before the match and suffix after. The matching element itself is not included. If no elements match, returns None.

Examples
#![feature(slice_split_once)]
let s = [1, 2, 3, 2, 4];
assert_eq!(s.split_once(|&x| x == 2), Some((
    &[1][..],
    &[3, 2, 4][..]
)));
assert_eq!(s.split_once(|&x| x == 0), None);

pub fn rsplit_once(&self, pred: F) -> Option<(&[T], &[T])>where F: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (slice_split_once)

Splits the slice on the last element that matches the specified predicate.

If any matching elements are present in the slice, returns the prefix before the match and suffix after. The matching element itself is not included. If no elements match, returns None.

Examples
#![feature(slice_split_once)]
let s = [1, 2, 3, 2, 4];
assert_eq!(s.rsplit_once(|&x| x == 2), Some((
    &[1, 2, 3][..],
    &[4][..]
)));
assert_eq!(s.rsplit_once(|&x| x == 0), None);

1.0.0 ·

pub fn contains(&self, x: &T) -> boolwhere T: PartialEq,

Returns true if the slice contains an element with the given value.

This operation is O( n).

Note that if you have a sorted slice, binary_search may be faster.

Examples
let v = [10, 40, 30];
assert!(v.contains(&30));
assert!(!v.contains(&50));

If you do not have a &T, but some other value that you can compare with one (for example, String implements PartialEq<str>), you can use iter().any:

let v = [String::from("hello"), String::from("world")]; // slice of `String`
assert!(v.iter().any(|e| e == "hello")); // search with `&str`
assert!(!v.iter().any(|e| e == "hi"));

1.0.0 ·

pub fn starts_with(&self, needle: &[T]) -> boolwhere T: PartialEq,

Returns true if needle is a prefix of the slice or equal to the slice.

Examples
let v = [10, 40, 30];
assert!(v.starts_with(&[10]));
assert!(v.starts_with(&[10, 40]));
assert!(v.starts_with(&v));
assert!(!v.starts_with(&[50]));
assert!(!v.starts_with(&[10, 50]));

Always returns true if needle is an empty slice:

let v = &[10, 40, 30];
assert!(v.starts_with(&[]));
let v: &[u8] = &[];
assert!(v.starts_with(&[]));

1.0.0 ·

pub fn ends_with(&self, needle: &[T]) -> boolwhere T: PartialEq,

Returns true if needle is a suffix of the slice or equal to the slice.

Examples
let v = [10, 40, 30];
assert!(v.ends_with(&[30]));
assert!(v.ends_with(&[40, 30]));
assert!(v.ends_with(&v));
assert!(!v.ends_with(&[50]));
assert!(!v.ends_with(&[50, 30]));

Always returns true if needle is an empty slice:

let v = &[10, 40, 30];
assert!(v.ends_with(&[]));
let v: &[u8] = &[];
assert!(v.ends_with(&[]));

1.51.0 ·

pub fn strip_prefix

(&self, prefix: &P) -> Option<&[T]>where P: SlicePattern<Item = T> + ?Sized, T: PartialEq,

Returns a subslice with the prefix removed.

If the slice starts with prefix, returns the subslice after the prefix, wrapped in Some. If prefix is empty, simply returns the original slice. If prefix is equal to the original slice, returns an empty slice.

If the slice does not start with prefix, returns None.

Examples
let v = &[10, 40, 30];
assert_eq!(v.strip_prefix(&[10]), Some(&[40, 30][..]));
assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..]));
assert_eq!(v.strip_prefix(&[10, 40, 30]), Some(&[][..]));
assert_eq!(v.strip_prefix(&[50]), None);
assert_eq!(v.strip_prefix(&[10, 50]), None);

let prefix : &str = "he";
assert_eq!(b"hello".strip_prefix(prefix.as_bytes()),
           Some(b"llo".as_ref()));

1.51.0 ·

pub fn strip_suffix

(&self, suffix: &P) -> Option<&[T]>where P: SlicePattern<Item = T> + ?Sized, T: PartialEq,

Returns a subslice with the suffix removed.

If the slice ends with suffix, returns the subslice before the suffix, wrapped in Some. If suffix is empty, simply returns the original slice. If suffix is equal to the original slice, returns an empty slice.

If the slice does not end with suffix, returns None.

Examples
let v = &[10, 40, 30];
assert_eq!(v.strip_suffix(&[30]), Some(&[10, 40][..]));
assert_eq!(v.strip_suffix(&[40, 30]), Some(&[10][..]));
assert_eq!(v.strip_suffix(&[10, 40, 30]), Some(&[][..]));
assert_eq!(v.strip_suffix(&[50]), None);
assert_eq!(v.strip_suffix(&[50, 30]), None);

1.0.0 ·

pub fn binary_search(&self, x: &T) -> Result<usize, usize>where T: Ord,

Binary searches this slice for a given element. If the slice is not sorted, the returned result is unspecified and meaningless.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

See also binary_search_by, binary_search_by_key, and partition_point.

Examples

Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in [1, 4].

let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

assert_eq!(s.binary_search(&13),  Ok(9));
assert_eq!(s.binary_search(&4),   Err(7));
assert_eq!(s.binary_search(&100), Err(13));
let r = s.binary_search(&1);
assert!(match r { Ok(1..=4) => true, _ => false, });

If you want to find that whole range of matching items, rather than an arbitrary matching one, that can be done using partition_point:

let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

let low = s.partition_point(|x| x < &1);
assert_eq!(low, 1);
let high = s.partition_point(|x| x <= &1);
assert_eq!(high, 5);
let r = s.binary_search(&1);
assert!((low..high).contains(&r.unwrap()));

assert!(s[..low].iter().all(|&x| x < 1));
assert!(s[low..high].iter().all(|&x| x == 1));
assert!(s[high..].iter().all(|&x| x > 1));

// For something not found, the "range" of equal items is empty
assert_eq!(s.partition_point(|x| x < &11), 9);
assert_eq!(s.partition_point(|x| x <= &11), 9);
assert_eq!(s.binary_search(&11), Err(9));

If you want to insert an item to a sorted vector, while maintaining sort order, consider using partition_point:

let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x <= num);
// If `num` is unique, `s.partition_point(|&x| x < num)` (with `<`) is equivalent to
// `s.binary_search(&num).unwrap_or_else(|x| x)`, but using `<=` will allow `insert`
// to shift less elements.
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);

1.0.0 ·

pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>where F: FnMut(&'a T) -> Ordering,

Binary searches this slice with a comparator function.

The comparator function should return an order code that indicates whether its argument is Less, Equal or Greater the desired target. If the slice is not sorted or if the comparator function does not implement an order consistent with the sort order of the underlying slice, the returned result is unspecified and meaningless.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

See also binary_search, binary_search_by_key, and partition_point.

Examples

Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in [1, 4].

let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

let seek = 13;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9));
let seek = 4;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(7));
let seek = 100;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(13));
let seek = 1;
let r = s.binary_search_by(|probe| probe.cmp(&seek));
assert!(match r { Ok(1..=4) => true, _ => false, });

1.10.0 ·

pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<usize, usize>where F: FnMut(&'a T) -> B, B: Ord,

Binary searches this slice with a key extraction function.

Assumes that the slice is sorted by the key, for instance with sort_by_key using the same key extraction function. If the slice is not sorted by the key, the returned result is unspecified and meaningless.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

See also binary_search, binary_search_by, and partition_point.

Examples

Looks up a series of four elements in a slice of pairs sorted by their second elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in [1, 4].

let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
         (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
         (1, 21), (2, 34), (4, 55)];

assert_eq!(s.binary_search_by_key(&13, |&(a, b)| b),  Ok(9));
assert_eq!(s.binary_search_by_key(&4, |&(a, b)| b),   Err(7));
assert_eq!(s.binary_search_by_key(&100, |&(a, b)| b), Err(13));
let r = s.binary_search_by_key(&1, |&(a, b)| b);
assert!(match r { Ok(1..=4) => true, _ => false, });

1.20.0 ·

pub fn sort_unstable(&mut self)where T: Ord,

Sorts the slice without preserving the initial order of equal elements.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O( n * log( n)) worst-case.

If the implementation of Ord for T does not implement a total order the resulting order of elements in the slice is unspecified. All original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. Same is true if the implementation of Ord for T panics.

Sorting types that only implement PartialOrd such as f32 and f64 require additional precautions. For example, f32::NAN != f32::NAN, which doesn’t fulfill the reflexivity requirement of Ord. By using an alternative comparison function with slice::sort_unstable_by such as f32::total_cmp or f64::total_cmp that defines a total order users can sort slices containing floating-point values. Alternatively, if all values in the slice are guaranteed to be in a subset for which PartialOrd::partial_cmpforms a total order, it’s possible to sort the slice with sort_unstable_by(|a, b| a.partial_cmp(b).unwrap()).

Current implementation

The current implementation is based on ipnsort by Lukas Bergdoll and Orson Peters, which combines the fast average case of quicksort with the fast worst case of heapsort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

It is typically faster than stable sorting, except in a few special cases, e.g., when the slice is partially sorted.

Panics

May panic if the implementation of Ord for T does not implement a total order.

Examples
let mut v = [4, -5, 1, -3, 2];

v.sort_unstable();
assert_eq!(v, [-5, -3, 1, 2, 4]);

1.20.0 ·

pub fn sort_unstable_by(&mut self, compare: F)where F: FnMut(&T, &T) -> Ordering,

Sorts the slice with a comparison function, without preserving the initial order of equal elements.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O( n * log( n)) worst-case.

If the comparison function compare does not implement a total order the resulting order of elements in the slice is unspecified. All original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. Same is true if compare panics.

For example |a, b| (a - b).cmp(a) is a comparison function that is neither transitive nor reflexive nor total, a < b < c < a with a = 1, b = 2, c = 3. For more information and examples see the Ord documentation.

Current implementation

The current implementation is based on ipnsort by Lukas Bergdoll and Orson Peters, which combines the fast average case of quicksort with the fast worst case of heapsort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

It is typically faster than stable sorting, except in a few special cases, e.g., when the slice is partially sorted.

Panics

May panic if compare does not implement a total order.

Examples
let mut v = [4, -5, 1, -3, 2];
v.sort_unstable_by(|a, b| a.cmp(b));
assert_eq!(v, [-5, -3, 1, 2, 4]);

// reverse sorting
v.sort_unstable_by(|a, b| b.cmp(a));
assert_eq!(v, [4, 2, 1, -3, -5]);

1.20.0 ·

pub fn sort_unstable_by_key<K, F>(&mut self, f: F)where F: FnMut(&T) -> K, K: Ord,

Sorts the slice with a key extraction function, without preserving the initial order of equal elements.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O( n * log( n)) worst-case.

If the implementation of Ord for K does not implement a total order the resulting order of elements in the slice is unspecified. All original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. Same is true if the implementation of Ord for K panics.

Current implementation

The current implementation is based on ipnsort by Lukas Bergdoll and Orson Peters, which combines the fast average case of quicksort with the fast worst case of heapsort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

It is typically faster than stable sorting, except in a few special cases, e.g., when the slice is partially sorted.

Panics

May panic if the implementation of Ord for K does not implement a total order.

Examples
let mut v = [4i32, -5, 1, -3, 2];

v.sort_unstable_by_key(|k| k.abs());
assert_eq!(v, [1, 2, -3, 4, -5]);

1.49.0 ·

pub fn select_nth_unstable( &mut self, index: usize, ) -> (&mut [T], &mut T, &mut [T])where T: Ord,

Reorders the slice such that the element at index after the reordering is at its final sorted position.

This reordering has the additional property that any value at position i < index will be less than or equal to any value at a position j > index. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position index), in-place (i.e. does not allocate), and runs in O( n) time. This function is also known as “kth element” in other libraries.

It returns a triplet of the following from the reordered slice: the subslice prior to index, the element at index, and the subslice after index; accordingly, the values in those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to the value of the element at index.

Current implementation

The current algorithm is an introselect implementation based on ipnsort by Lukas Bergdoll and Orson Peters, which is also the basis for sort_unstable. The fallback algorithm is Median of Medians using Tukey’s Ninther for pivot selection, which guarantees linear runtime for all inputs.

Panics

Panics when index >= len(), meaning it always panics on empty slices.

May panic if the implementation of Ord for T does not implement a total order.

Examples
let mut v = [-5i32, 4, 2, -3, 1];

// Find the items less than or equal to the median, the median, and greater than or equal to
// the median.
let (lesser, median, greater) = v.select_nth_unstable(2);

assert!(lesser == [-3, -5] || lesser == [-5, -3]);
assert_eq!(median, &mut 1);
assert!(greater == [4, 2] || greater == [2, 4]);

// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [-3, -5, 1, 2, 4] ||
        v == [-5, -3, 1, 2, 4] ||
        v == [-3, -5, 1, 4, 2] ||
        v == [-5, -3, 1, 4, 2]);

1.49.0 ·

pub fn select_nth_unstable_by( &mut self, index: usize, compare: F, ) -> (&mut [T], &mut T, &mut [T])where F: FnMut(&T, &T) -> Ordering,

Reorders the slice with a comparator function such that the element at index after the reordering is at its final sorted position.

This reordering has the additional property that any value at position i < index will be less than or equal to any value at a position j > index using the comparator function. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position index), in-place (i.e. does not allocate), and runs in O( n) time. This function is also known as “kth element” in other libraries.

It returns a triplet of the following from the slice reordered according to the provided comparator function: the subslice prior to index, the element at index, and the subslice after index; accordingly, the values in those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to the value of the element at index.

Current implementation

The current algorithm is an introselect implementation based on ipnsort by Lukas Bergdoll and Orson Peters, which is also the basis for sort_unstable. The fallback algorithm is Median of Medians using Tukey’s Ninther for pivot selection, which guarantees linear runtime for all inputs.

Panics

Panics when index >= len(), meaning it always panics on empty slices.

May panic if compare does not implement a total order.

Examples
let mut v = [-5i32, 4, 2, -3, 1];

// Find the items less than or equal to the median, the median, and greater than or equal to
// the median as if the slice were sorted in descending order.
let (lesser, median, greater) = v.select_nth_unstable_by(2, |a, b| b.cmp(a));

assert!(lesser == [4, 2] || lesser == [2, 4]);
assert_eq!(median, &mut 1);
assert!(greater == [-3, -5] || greater == [-5, -3]);

// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [2, 4, 1, -5, -3] ||
        v == [2, 4, 1, -3, -5] ||
        v == [4, 2, 1, -5, -3] ||
        v == [4, 2, 1, -3, -5]);

1.49.0 ·

pub fn select_nth_unstable_by_key<K, F>( &mut self, index: usize, f: F, ) -> (&mut [T], &mut T, &mut [T])where F: FnMut(&T) -> K, K: Ord,

Reorders the slice with a key extraction function such that the element at index after the reordering is at its final sorted position.

This reordering has the additional property that any value at position i < index will be less than or equal to any value at a position j > index using the key extraction function. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position index), in-place (i.e. does not allocate), and runs in O( n) time. This function is also known as “kth element” in other libraries.

It returns a triplet of the following from the slice reordered according to the provided key extraction function: the subslice prior to index, the element at index, and the subslice after index; accordingly, the values in those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to the value of the element at index.

Current implementation

The current algorithm is an introselect implementation based on ipnsort by Lukas Bergdoll and Orson Peters, which is also the basis for sort_unstable. The fallback algorithm is Median of Medians using Tukey’s Ninther for pivot selection, which guarantees linear runtime for all inputs.

Panics

Panics when index >= len(), meaning it always panics on empty slices.

May panic if K: Ord does not implement a total order.

Examples
let mut v = [-5i32, 4, 1, -3, 2];

// Find the items less than or equal to the median, the median, and greater than or equal to
// the median as if the slice were sorted according to absolute value.
let (lesser, median, greater) = v.select_nth_unstable_by_key(2, |a| a.abs());

assert!(lesser == [1, 2] || lesser == [2, 1]);
assert_eq!(median, &mut -3);
assert!(greater == [4, -5] || greater == [-5, 4]);

// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [1, 2, -3, 4, -5] ||
        v == [1, 2, -3, -5, 4] ||
        v == [2, 1, -3, 4, -5] ||
        v == [2, 1, -3, -5, 4]);

pub fn partition_dedup(&mut self) -> (&mut [T], &mut [T])where T: PartialEq,

🔬This is a nightly-only experimental API. (slice_partition_dedup)

Moves all consecutive repeated elements to the end of the slice according to the PartialEq trait implementation.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

If the slice is sorted, the first returned slice contains no duplicates.

Examples
#![feature(slice_partition_dedup)]

let mut slice = [1, 2, 2, 3, 3, 2, 1, 1];

let (dedup, duplicates) = slice.partition_dedup();

assert_eq!(dedup, [1, 2, 3, 2, 1]);
assert_eq!(duplicates, [2, 3, 1]);

pub fn partition_dedup_by(&mut self, same_bucket: F) -> (&mut [T], &mut [T])where F: FnMut(&mut T, &mut T) -> bool,

🔬This is a nightly-only experimental API. (slice_partition_dedup)

Moves all but the first of consecutive elements to the end of the slice satisfying a given equality relation.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

The same_bucket function is passed references to two elements from the slice and must determine if the elements compare equal. The elements are passed in opposite order from their order in the slice, so if same_bucket(a, b) returns true, a is moved at the end of the slice.

If the slice is sorted, the first returned slice contains no duplicates.

Examples
#![feature(slice_partition_dedup)]

let mut slice = ["foo", "Foo", "BAZ", "Bar", "bar", "baz", "BAZ"];

let (dedup, duplicates) = slice.partition_dedup_by(|a, b| a.eq_ignore_ascii_case(b));

assert_eq!(dedup, ["foo", "BAZ", "Bar", "baz"]);
assert_eq!(duplicates, ["bar", "Foo", "BAZ"]);

pub fn partition_dedup_by_key<K, F>(&mut self, key: F) -> (&mut [T], &mut [T])where F: FnMut(&mut T) -> K, K: PartialEq,

🔬This is a nightly-only experimental API. (slice_partition_dedup)

Moves all but the first of consecutive elements to the end of the slice that resolve to the same key.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

If the slice is sorted, the first returned slice contains no duplicates.

Examples
#![feature(slice_partition_dedup)]

let mut slice = [10, 20, 21, 30, 30, 20, 11, 13];

let (dedup, duplicates) = slice.partition_dedup_by_key(|i| *i / 10);

assert_eq!(dedup, [10, 20, 30, 20, 11]);
assert_eq!(duplicates, [21, 30, 13]);

1.26.0 ·

pub fn rotate_left(&mut self, mid: usize)

Rotates the slice in-place such that the first mid elements of the slice move to the end while the last self.len() - mid elements move to the front.

After calling rotate_left, the element previously at index mid will become the first element in the slice.

Panics

This function will panic if mid is greater than the length of the slice. Note that mid == self.len() does not panic and is a no-op rotation.

Complexity

Takes linear (in self.len()) time.

Examples
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a.rotate_left(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);

Rotating a subslice:

let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a[1..5].rotate_left(1);
assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']);

1.26.0 ·

pub fn rotate_right(&mut self, k: usize)

Rotates the slice in-place such that the first self.len() - kelements of the slice move to the end while the last k elements move to the front.

After calling rotate_right, the element previously at index self.len() - k will become the first element in the slice.

Panics

This function will panic if k is greater than the length of the slice. Note that k == self.len() does not panic and is a no-op rotation.

Complexity

Takes linear (in self.len()) time.

Examples
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a.rotate_right(2);
assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);

Rotating a subslice:

let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a[1..5].rotate_right(1);
assert_eq!(a, ['a', 'e', 'b', 'c', 'd', 'f']);

1.50.0 ·

pub fn fill(&mut self, value: T)where T: Clone,

Fills self with elements by cloning value.

Examples
let mut buf = vec![0; 10];
buf.fill(1);
assert_eq!(buf, vec![1; 10]);

1.51.0 ·

pub fn fill_with(&mut self, f: F)where F: FnMut() -> T,

Fills self with elements returned by calling a closure repeatedly.

This method uses a closure to create new values. If you’d rather Clone a given value, use fill. If you want to use the Defaulttrait to generate values, you can pass Default::default as the argument.

Examples
let mut buf = vec![1; 10];
buf.fill_with(Default::default);
assert_eq!(buf, vec![0; 10]);

1.7.0 ·

pub fn clone_from_slice(&mut self, src: &[T])where T: Clone,

Copies the elements from src into self.

The length of src must be the same as self.

Panics

This function will panic if the two slices have different lengths.

Examples

Cloning two elements from a slice into another:

let src = [1, 2, 3, 4];
let mut dst = [0, 0];

// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
dst.clone_from_slice(&src[2..]);

assert_eq!(src, [1, 2, 3, 4]);
assert_eq!(dst, [3, 4]);

Rust enforces that there can only be one mutable reference with no immutable references to a particular piece of data in a particular scope. Because of this, attempting to use clone_from_slice on a single slice will result in a compile failure:ⓘ

let mut slice = [1, 2, 3, 4, 5];

slice[..2].clone_from_slice(&slice[3..]); // compile fail!

To work around this, we can use split_at_mut to create two distinct sub-slices from a slice:

let mut slice = [1, 2, 3, 4, 5];

{
    let (left, right) = slice.split_at_mut(2);
    left.clone_from_slice(&right[1..]);
}

assert_eq!(slice, [4, 5, 3, 4, 5]);

1.9.0 ·

pub fn copy_from_slice(&mut self, src: &[T])where T: Copy,

Copies all elements from src into self, using a memcpy.

The length of src must be the same as self.

If T does not implement Copy, use clone_from_slice.

Panics

This function will panic if the two slices have different lengths.

Examples

Copying two elements from a slice into another:

let src = [1, 2, 3, 4];
let mut dst = [0, 0];

// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
dst.copy_from_slice(&src[2..]);

assert_eq!(src, [1, 2, 3, 4]);
assert_eq!(dst, [3, 4]);

Rust enforces that there can only be one mutable reference with no immutable references to a particular piece of data in a particular scope. Because of this, attempting to use copy_from_slice on a single slice will result in a compile failure:ⓘ

let mut slice = [1, 2, 3, 4, 5];

slice[..2].copy_from_slice(&slice[3..]); // compile fail!

To work around this, we can use split_at_mut to create two distinct sub-slices from a slice:

let mut slice = [1, 2, 3, 4, 5];

{
    let (left, right) = slice.split_at_mut(2);
    left.copy_from_slice(&right[1..]);
}

assert_eq!(slice, [4, 5, 3, 4, 5]);

1.37.0 ·

pub fn copy_within(&mut self, src: R, dest: usize)where R: RangeBounds, T: Copy,

Copies elements from one part of the slice to another part of itself, using a memmove.

src is the range within self to copy from. dest is the starting index of the range within self to copy to, which will have the same length as src. The two ranges may overlap. The ends of the two ranges must be less than or equal to self.len().

Panics

This function will panic if either range exceeds the end of the slice, or if the end of src is before the start.

Examples

Copying four bytes within a slice:

let mut bytes = *b"Hello, World!";

bytes.copy_within(1..5, 8);

assert_eq!(&bytes, b"Hello, Wello!");

1.27.0 ·

pub fn swap_with_slice(&mut self, other: &mut [T])

Swaps all elements in self with those in other.

The length of other must be the same as self.

Panics

This function will panic if the two slices have different lengths.

Example

Swapping two elements across slices:

let mut slice1 = [0, 0];
let mut slice2 = [1, 2, 3, 4];

slice1.swap_with_slice(&mut slice2[2..]);

assert_eq!(slice1, [3, 4]);
assert_eq!(slice2, [1, 2, 0, 0]);

Rust enforces that there can only be one mutable reference to a particular piece of data in a particular scope. Because of this, attempting to use swap_with_slice on a single slice will result in a compile failure:ⓘ

let mut slice = [1, 2, 3, 4, 5];
slice[..2].swap_with_slice(&mut slice[3..]); // compile fail!

To work around this, we can use split_at_mut to create two distinct mutable sub-slices from a slice:

let mut slice = [1, 2, 3, 4, 5];

{
    let (left, right) = slice.split_at_mut(2);
    left.swap_with_slice(&mut right[1..]);
}

assert_eq!(slice, [4, 5, 3, 1, 2]);

1.30.0 ·

pub unsafe fn align_to(&self) -> (&[T], &[U], &[T])

Transmutes the slice to a slice of another type, ensuring alignment of the types is maintained.

This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The middle part will be as big as possible under the given alignment constraint and element size.

This method has no purpose when either input element T or output element U are zero-sized and will return the original slice without splitting anything.

Safety

This method is essentially a transmute with respect to the elements in the returned middle slice, so all the usual caveats pertaining to transmute::<T, U> also apply here.

Examples

Basic usage:

unsafe {
    let bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
    let (prefix, shorts, suffix) = bytes.align_to::<u16>();
    // less_efficient_algorithm_for_bytes(prefix);
    // more_efficient_algorithm_for_aligned_shorts(shorts);
    // less_efficient_algorithm_for_bytes(suffix);
}

1.30.0 ·

pub unsafe fn align_to_mut(&mut self) -> (&mut [T], &mut [U], &mut [T])

Transmutes the mutable slice to a mutable slice of another type, ensuring alignment of the types is maintained.

This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The middle part will be as big as possible under the given alignment constraint and element size.

This method has no purpose when either input element T or output element U are zero-sized and will return the original slice without splitting anything.

Safety

This method is essentially a transmute with respect to the elements in the returned middle slice, so all the usual caveats pertaining to transmute::<T, U> also apply here.

Examples

Basic usage:

unsafe {
    let mut bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
    let (prefix, shorts, suffix) = bytes.align_to_mut::<u16>();
    // less_efficient_algorithm_for_bytes(prefix);
    // more_efficient_algorithm_for_aligned_shorts(shorts);
    // less_efficient_algorithm_for_bytes(suffix);
}

pub fn as_simd(&self) -> (&[T], &[Simd<T, LANES>], &[T])where Simd<T, LANES>: AsRef<[T; LANES]>, T: SimdElement, LaneCount: SupportedLaneCount,

🔬This is a nightly-only experimental API. (portable_simd)

Splits a slice into a prefix, a middle of aligned SIMD types, and a suffix.

This is a safe wrapper around slice::align_to, so inherits the same guarantees as that method.

Panics

This will panic if the size of the SIMD type is different from LANES times that of the scalar.

At the time of writing, the trait restrictions on Simd<T, LANES> keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like LANES == 3.

Examples
#![feature(portable_simd)]
use core::simd::prelude::*;

let short = &[1, 2, 3];
let (prefix, middle, suffix) = short.as_simd::<4>();
assert_eq!(middle, []); // Not enough elements for anything in the middle

// They might be split in any possible way between prefix and suffix
let it = prefix.iter().chain(suffix).copied();
assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);

fn basic_simd_sum(x: &[f32]) -> f32 {
    use std::ops::Add;
    let (prefix, middle, suffix) = x.as_simd();
    let sums = f32x4::from_array([
        prefix.iter().copied().sum(),
        0.0,
        0.0,
        suffix.iter().copied().sum(),
    ]);
    let sums = middle.iter().copied().fold(sums, f32x4::add);
    sums.reduce_sum()
}

let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);

pub fn as_simd_mut( &mut self, ) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])where Simd<T, LANES>: AsMut<[T; LANES]>, T: SimdElement, LaneCount: SupportedLaneCount,

🔬This is a nightly-only experimental API. (portable_simd)

Splits a mutable slice into a mutable prefix, a middle of aligned SIMD types, and a mutable suffix.

This is a safe wrapper around slice::align_to_mut, so inherits the same guarantees as that method.

This is the mutable version of slice::as_simd; see that for examples.

Panics

This will panic if the size of the SIMD type is different from LANES times that of the scalar.

At the time of writing, the trait restrictions on Simd<T, LANES> keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like LANES == 3.1.82.0 ·

pub fn is_sorted(&self) -> boolwhere T: PartialOrd,

Checks if the elements of this slice are sorted.

That is, for each element a and its following element b, a <= b must hold. If the slice yields exactly zero or one element, true is returned.

Note that if Self::Item is only PartialOrd, but not Ord, the above definition implies that this function returns false if any two consecutive items are not comparable.

Examples
let empty: [i32; 0] = [];

assert!([1, 2, 2, 9].is_sorted());
assert!(![1, 3, 2, 4].is_sorted());
assert!([0].is_sorted());
assert!(empty.is_sorted());
assert!(![0.0, 1.0, f32::NAN].is_sorted());

1.82.0 ·

pub fn is_sorted_by<'a, F>(&'a self, compare: F) -> boolwhere F: FnMut(&'a T, &'a T) -> bool,

Checks if the elements of this slice are sorted using the given comparator function.

Instead of using PartialOrd::partial_cmp, this function uses the given comparefunction to determine whether two elements are to be considered in sorted order.

Examples
assert!([1, 2, 2, 9].is_sorted_by(|a, b| a <= b));
assert!(![1, 2, 2, 9].is_sorted_by(|a, b| a < b));

assert!([0].is_sorted_by(|a, b| true));
assert!([0].is_sorted_by(|a, b| false));

let empty: [i32; 0] = [];
assert!(empty.is_sorted_by(|a, b| false));
assert!(empty.is_sorted_by(|a, b| true));

1.82.0 ·

pub fn is_sorted_by_key<'a, F, K>(&'a self, f: F) -> boolwhere F: FnMut(&'a T) -> K, K: PartialOrd,

Checks if the elements of this slice are sorted using the given key extraction function.

Instead of comparing the slice’s elements directly, this function compares the keys of the elements, as determined by f. Apart from that, it’s equivalent to is_sorted; see its documentation for more information.

Examples
assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));

1.52.0 ·

pub fn partition_point

(&self, pred: P) -> usizewhere P: FnMut(&T) -> bool,

Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).

The slice is assumed to be partitioned according to the given predicate. This means that all elements for which the predicate returns true are at the start of the slice and all elements for which the predicate returns false are at the end. For example, [7, 15, 3, 5, 4, 12, 6] is partitioned under the predicate x % 2 != 0(all odd numbers are at the start, all even at the end).

If this slice is not partitioned, the returned result is unspecified and meaningless, as this method performs a kind of binary search.

See also binary_search, binary_search_by, and binary_search_by_key.

Examples
let v = [1, 2, 3, 3, 5, 6, 7];
let i = v.partition_point(|&x| x < 5);

assert_eq!(i, 4);
assert!(v[..i].iter().all(|&x| x < 5));
assert!(v[i..].iter().all(|&x| !(x < 5)));

If all elements of the slice match the predicate, including if the slice is empty, then the length of the slice will be returned:

let a = [2, 4, 8];
assert_eq!(a.partition_point(|x| x < &100), a.len());
let a: [i32; 0] = [];
assert_eq!(a.partition_point(|x| x < &100), 0);

If you want to insert an item to a sorted vector, while maintaining sort order:

let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x <= num);
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);

pub fn take<'a, R>(self: &mut &'a [T], range: R) -> Option<&'a [T]>where R: OneSidedRange,

🔬This is a nightly-only experimental API. (slice_take)

Removes the subslice corresponding to the given range and returns a reference to it.

Returns None and does not modify the slice if the given range is out of bounds.

Note that this method only accepts one-sided ranges such as 2.. or ..6, but not 2..6.

Examples

Taking the first three elements of a slice:

#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c', 'd'];
let mut first_three = slice.take(..3).unwrap();

assert_eq!(slice, &['d']);
assert_eq!(first_three, &['a', 'b', 'c']);

Taking the last two elements of a slice:

#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c', 'd'];
let mut tail = slice.take(2..).unwrap();

assert_eq!(slice, &['a', 'b']);
assert_eq!(tail, &['c', 'd']);

Getting None when range is out of bounds:

#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c', 'd'];

assert_eq!(None, slice.take(5..));
assert_eq!(None, slice.take(..5));
assert_eq!(None, slice.take(..=4));
let expected: &[char] = &['a', 'b', 'c', 'd'];
assert_eq!(Some(expected), slice.take(..4));

pub fn take_mut<'a, R>(self: &mut &'a mut [T], range: R) -> Option<&'a mut [T]>where R: OneSidedRange,

🔬This is a nightly-only experimental API. (slice_take)

Removes the subslice corresponding to the given range and returns a mutable reference to it.

Returns None and does not modify the slice if the given range is out of bounds.

Note that this method only accepts one-sided ranges such as 2.. or ..6, but not 2..6.

Examples

Taking the first three elements of a slice:

#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
let mut first_three = slice.take_mut(..3).unwrap();

assert_eq!(slice, &mut ['d']);
assert_eq!(first_three, &mut ['a', 'b', 'c']);

Taking the last two elements of a slice:

#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
let mut tail = slice.take_mut(2..).unwrap();

assert_eq!(slice, &mut ['a', 'b']);
assert_eq!(tail, &mut ['c', 'd']);

Getting None when range is out of bounds:

#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];

assert_eq!(None, slice.take_mut(5..));
assert_eq!(None, slice.take_mut(..5));
assert_eq!(None, slice.take_mut(..=4));
let expected: &mut [_] = &mut ['a', 'b', 'c', 'd'];
assert_eq!(Some(expected), slice.take_mut(..4));

pub fn take_first<'a>(self: &mut &'a [T]) -> Option<&'a T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the first element of the slice and returns a reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c'];
let first = slice.take_first().unwrap();

assert_eq!(slice, &['b', 'c']);
assert_eq!(first, &'a');

pub fn take_first_mut<'a>(self: &mut &'a mut [T]) -> Option<&'a mut T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the first element of the slice and returns a mutable reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c'];
let first = slice.take_first_mut().unwrap();
*first = 'd';

assert_eq!(slice, &['b', 'c']);
assert_eq!(first, &'d');

pub fn take_last<'a>(self: &mut &'a [T]) -> Option<&'a T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the last element of the slice and returns a reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c'];
let last = slice.take_last().unwrap();

assert_eq!(slice, &['a', 'b']);
assert_eq!(last, &'c');

pub fn take_last_mut<'a>(self: &mut &'a mut [T]) -> Option<&'a mut T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the last element of the slice and returns a mutable reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c'];
let last = slice.take_last_mut().unwrap();
*last = 'd';

assert_eq!(slice, &['a', 'b']);
assert_eq!(last, &'d');

pub unsafe fn get_many_unchecked_mut( &mut self, indices: [usize; N], ) -> [&mut T; N]

🔬This is a nightly-only experimental API. (get_many_mut)

Returns mutable references to many indices at once, without doing any checks.

For a safe alternative see get_many_mut.

Safety

Calling this method with overlapping or out-of-bounds indices is _undefined behavior_even if the resulting references are not used.

Examples
#![feature(get_many_mut)]

let x = &mut [1, 2, 4];

unsafe {
    let [a, b] = x.get_many_unchecked_mut([0, 2]);
    *a *= 10;
    *b *= 100;
}
assert_eq!(x, &[10, 2, 400]);

pub fn get_many_mut( &mut self, indices: [usize; N], ) -> Result<[&mut T; N], GetManyMutError>

🔬This is a nightly-only experimental API. (get_many_mut)

Returns mutable references to many indices at once.

Returns an error if any index is out-of-bounds, or if the same index was passed more than once.

Examples
#![feature(get_many_mut)]

let v = &mut [1, 2, 3];
if let Ok([a, b]) = v.get_many_mut([0, 2]) {
    *a = 413;
    *b = 612;
}
assert_eq!(v, &[413, 2, 612]);

pub fn elem_offset(&self, element: &T) -> Option

🔬This is a nightly-only experimental API. (substr_range)

Returns the index that an element reference points to.

Returns None if element does not point within the slice or if it points between elements.

This method is useful for extending slice iterators like slice::split.

Note that this uses pointer arithmetic and does not compare elements. To find the index of an element via comparison, use .iter().position() instead.

Panics

Panics if T is zero-sized.

Examples

Basic usage:

#![feature(substr_range)]

let nums: &[u32] = &[1, 7, 1, 1];
let num = &nums[2];

assert_eq!(num, &1);
assert_eq!(nums.elem_offset(num), Some(2));

Returning None with an in-between element:

#![feature(substr_range)]

let arr: &[[u32; 2]] = &[[0, 1], [2, 3]];
let flat_arr: &[u32] = arr.as_flattened();

let ok_elm: &[u32; 2] = flat_arr[0..2].try_into().unwrap();
let weird_elm: &[u32; 2] = flat_arr[1..3].try_into().unwrap();

assert_eq!(ok_elm, &[0, 1]);
assert_eq!(weird_elm, &[1, 2]);

assert_eq!(arr.elem_offset(ok_elm), Some(0)); // Points to element 0
assert_eq!(arr.elem_offset(weird_elm), None); // Points between element 0 and 1

pub fn subslice_range(&self, subslice: &[T]) -> Option<Range>

🔬This is a nightly-only experimental API. (substr_range)

Returns the range of indices that a subslice points to.

Returns None if subslice does not point within the slice or if it points between elements.

This method does not compare elements. Instead, this method finds the location in the slice that subslice was obtained from. To find the index of a subslice via comparison, instead use .windows() .position().

This method is useful for extending slice iterators like slice::split.

Note that this may return a false positive (either Some(0..0) or Some(self.len()..self.len())) if subslice has a length of zero and points to the beginning or end of another, separate, slice.

Panics

Panics if T is zero-sized.

Examples

Basic usage:

#![feature(substr_range)]

let nums = &[0, 5, 10, 0, 0, 5];

let mut iter = nums
    .split(|t| *t == 0)
    .map(|n| nums.subslice_range(n).unwrap());

assert_eq!(iter.next(), Some(0..0));
assert_eq!(iter.next(), Some(1..3));
assert_eq!(iter.next(), Some(4..4));
assert_eq!(iter.next(), Some(5..6));

1.80.0 ·

pub fn as_flattened(&self) -> &[T]

Takes a &[[T; N]], and flattens it to a &[T].

Panics

This panics if the length of the resulting slice would overflow a usize.

This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If size_of::<T>() > 0, this will never panic.

Examples
assert_eq!([[1, 2, 3], [4, 5, 6]].as_flattened(), &[1, 2, 3, 4, 5, 6]);

assert_eq!(
    [[1, 2, 3], [4, 5, 6]].as_flattened(),
    [[1, 2], [3, 4], [5, 6]].as_flattened(),
);

let slice_of_empty_arrays: &[[i32; 0]] = &[[], [], [], [], []];
assert!(slice_of_empty_arrays.as_flattened().is_empty());

let empty_slice_of_arrays: &[[u32; 10]] = &[];
assert!(empty_slice_of_arrays.as_flattened().is_empty());

1.80.0 ·

pub fn as_flattened_mut(&mut self) -> &mut [T]

Takes a &mut [[T; N]], and flattens it to a &mut [T].

Panics

This panics if the length of the resulting slice would overflow a usize.

This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If size_of::<T>() > 0, this will never panic.

Examples
fn add_5_to_all(slice: &mut [i32]) {
    for i in slice {
        *i += 5;
    }
}

let mut array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
add_5_to_all(array.as_flattened_mut());
assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);

pub fn sort_floats(&mut self)

🔬This is a nightly-only experimental API. (sort_floats)

Sorts the slice of floats.

This sort is in-place (i.e. does not allocate), O( n * log( n)) worst-case, and uses the ordering defined by f32::total_cmp.

Current implementation

This uses the same sorting algorithm as sort_unstable_by.

Examples
#![feature(sort_floats)]
let mut v = [2.6, -5e-8, f32::NAN, 8.29, f32::INFINITY, -1.0, 0.0, -f32::INFINITY, -0.0];

v.sort_floats();
let sorted = [-f32::INFINITY, -1.0, -5e-8, -0.0, 0.0, 2.6, 8.29, f32::INFINITY, f32::NAN];
assert_eq!(&v[..8], &sorted[..8]);
assert!(v[8].is_nan());

pub fn sort_floats(&mut self)

🔬This is a nightly-only experimental API. (sort_floats)

Sorts the slice of floats.

This sort is in-place (i.e. does not allocate), O( n * log( n)) worst-case, and uses the ordering defined by f64::total_cmp.

Current implementation

This uses the same sorting algorithm as sort_unstable_by.

Examples
#![feature(sort_floats)]
let mut v = [2.6, -5e-8, f64::NAN, 8.29, f64::INFINITY, -1.0, 0.0, -f64::INFINITY, -0.0];

v.sort_floats();
let sorted = [-f64::INFINITY, -1.0, -5e-8, -0.0, 0.0, 2.6, 8.29, f64::INFINITY, f64::NAN];
assert_eq!(&v[..8], &sorted[..8]);
assert!(v[8].is_nan());

1.79.0 ·

pub fn utf8_chunks(&self) -> Utf8Chunks<'_>

Creates an iterator over the contiguous valid UTF-8 ranges of this slice, and the non-UTF-8 fragments in between.

See the Utf8Chunk type for documenation of the items yielded by this iterator.

Examples

This function formats arbitrary but mostly-UTF-8 bytes into Rust source code in the form of a C-string literal ( c"...").

use std::fmt::Write as _;

pub fn cstr_literal(bytes: &[u8]) -> String {
    let mut repr = String::new();
    repr.push_str("c\"");
    for chunk in bytes.utf8_chunks() {
        for ch in chunk.valid().chars() {
            // Escapes \0, \t, \r, \n, \\, \', \", and uses \u{...} for non-printable characters.
            write!(repr, "{}", ch.escape_debug()).unwrap();
        }
        for byte in chunk.invalid() {
            write!(repr, "\\x{:02X}", byte).unwrap();
        }
    }
    repr.push('"');
    repr
}

fn main() {
    let lit = cstr_literal(b"\xferris the \xf0\x9f\xa6\x80\x07");
    let expected = stringify!(c"\xFErris the 🦀\u{7}");
    assert_eq!(lit, expected);
}

1.0.0 ·

pub fn sort(&mut self)where T: Ord,

Sorts the slice, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( n * log( n)) worst-case.

If the implementation of Ord for T does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn’t allocate auxiliary memory. See sort_unstable. The exception are partially sorted slices, which may be better served with slice::sort.

Sorting types that only implement PartialOrd such as f32 and f64 require additional precautions. For example, f32::NAN != f32::NAN, which doesn’t fulfill the reflexivity requirement of Ord. By using an alternative comparison function with slice::sort_by such as f32::total_cmp or f64::total_cmp that defines a total order users can sort slices containing floating-point values. Alternatively, if all values in the slice are guaranteed to be in a subset for which PartialOrd::partial_cmp forms a total order, it’s possible to sort the slice with sort_by(|a, b| a.partial_cmp(b).unwrap()).

Current implementation

The current implementation is based on driftsort by Orson Peters and Lukas Bergdoll, which combines the fast average case of quicksort with the fast worst case and partial run detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

The auxiliary memory allocation behavior depends on the input length. Short slices are handled without allocation, medium sized slices allocate self.len() and beyond that it clamps at self.len() / 2.

Panics

May panic if the implementation of Ord for T does not implement a total order, or if the Ord implementation itself panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4, -5, 1, -3, 2];

v.sort();
assert_eq!(v, [-5, -3, 1, 2, 4]);

1.0.0 ·

pub fn sort_by(&mut self, compare: F)where F: FnMut(&T, &T) -> Ordering,

Sorts the slice with a comparison function, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( n * log( n)) worst-case.

If the comparison function compare does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

For example |a, b| (a - b).cmp(a) is a comparison function that is neither transitive nor reflexive nor total, a < b < c < a with a = 1, b = 2, c = 3. For more information and examples see the Ord documentation.

Current implementation

The current implementation is based on driftsort by Orson Peters and Lukas Bergdoll, which combines the fast average case of quicksort with the fast worst case and partial run detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

The auxiliary memory allocation behavior depends on the input length. Short slices are handled without allocation, medium sized slices allocate self.len() and beyond that it clamps at self.len() / 2.

Panics

May panic if compare does not implement a total order, or if compare itself panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4, -5, 1, -3, 2];
v.sort_by(|a, b| a.cmp(b));
assert_eq!(v, [-5, -3, 1, 2, 4]);

// reverse sorting
v.sort_by(|a, b| b.cmp(a));
assert_eq!(v, [4, 2, 1, -3, -5]);

1.7.0 ·

pub fn sort_by_key<K, F>(&mut self, f: F)where F: FnMut(&T) -> K, K: Ord,

Sorts the slice with a key extraction function, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( m * n * log( n)) worst-case, where the key function is O( m).

If the implementation of Ord for K does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

Current implementation

The current implementation is based on driftsort by Orson Peters and Lukas Bergdoll, which combines the fast average case of quicksort with the fast worst case and partial run detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

The auxiliary memory allocation behavior depends on the input length. Short slices are handled without allocation, medium sized slices allocate self.len() and beyond that it clamps at self.len() / 2.

Panics

May panic if the implementation of Ord for K does not implement a total order, or if the Ord implementation or the key-function f panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4i32, -5, 1, -3, 2];

v.sort_by_key(|k| k.abs());
assert_eq!(v, [1, 2, -3, 4, -5]);

1.34.0 ·

pub fn sort_by_cached_key<K, F>(&mut self, f: F)where F: FnMut(&T) -> K, K: Ord,

Sorts the slice with a key extraction function, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( m * n + n * log( n)) worst-case, where the key function is O( m).

During sorting, the key function is called at most once per element, by using temporary storage to remember the results of key evaluation. The order of calls to the key function is unspecified and may change in future versions of the standard library.

If the implementation of Ord for K does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

For simple key functions (e.g., functions that are property accesses or basic operations), sort_by_key is likely to be faster.

Current implementation

The current implementation is based on instruction-parallel-network sort by Lukas Bergdoll, which combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on fully sorted and reversed inputs. And O( k * log( n)) where k is the number of distinct elements in the input. It leverages superscalar out-of-order execution capabilities commonly found in CPUs, to efficiently perform the operation.

In the worst case, the algorithm allocates temporary storage in a Vec<(K, usize)> the length of the slice.

Panics

May panic if the implementation of Ord for K does not implement a total order, or if the Ord implementation panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4i32, -5, 1, -3, 2, 10];

// Strings are sorted by lexicographical order.
v.sort_by_cached_key(|k| k.to_string());
assert_eq!(v, [-3, -5, 1, 10, 2, 4]);

1.0.0 ·

pub fn to_vec(&self) -> Vecwhere T: Clone,

Copies self into a new Vec.

Examples
let s = [10, 40, 30];
let x = s.to_vec();
// Here, `s` and `x` can be modified independently.

pub fn to_vec_in(&self, alloc: A) -> Vec<T, A>where A: Allocator, T: Clone,

🔬This is a nightly-only experimental API. (allocator_api)

Copies self into a new Vec with an allocator.

Examples
#![feature(allocator_api)]

use std::alloc::System;

let s = [10, 40, 30];
let x = s.to_vec_in(System);
// Here, `s` and `x` can be modified independently.

1.40.0 ·

pub fn repeat(&self, n: usize) -> Vecwhere T: Copy,

Creates a vector by copying a slice n times.

Panics

This function will panic if the capacity would overflow.

Examples

Basic usage:

assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);

A panic upon overflow:ⓘ

// this will panic at runtime
b"0123456789abcdef".repeat(usize::MAX);

1.0.0 ·

pub fn concat(&self) -> <[T] as Concat>::Output ⓘwhere [T]: Concat, Item: ?Sized,

Flattens a slice of T into a single value Self::Output.

Examples
assert_eq!(["hello", "world"].concat(), "helloworld");
assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);

1.3.0 ·

pub fn join( &self, sep: Separator, ) -> <[T] as Join>::Output ⓘwhere [T]: Join,

Flattens a slice of T into a single value Self::Output, placing a given separator between each.

Examples
assert_eq!(["hello", "world"].join(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);

1.0.0 ·

pub fn connect( &self, sep: Separator, ) -> <[T] as Join>::Output ⓘwhere [T]: Join,

👎Deprecated since 1.3.0: renamed to join

Flattens a slice of T into a single value Self::Output, placing a given separator between each.

Examples
assert_eq!(["hello", "world"].connect(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);

1.23.0 ·

pub fn to_ascii_uppercase(&self) -> Vec

Returns a vector containing a copy of this slice where each byte is mapped to its ASCII upper case equivalent.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

To uppercase the value in-place, use make_ascii_uppercase.1.23.0 ·

pub fn to_ascii_lowercase(&self) -> Vec

Returns a vector containing a copy of this slice where each byte is mapped to its ASCII lower case equivalent.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

To lowercase the value in-place, use make_ascii_lowercase.

Trait Implementations

impl Clone for Data

fn clone(&self) -> Data ⓘ

Returns a copy of the value. Read more1.0.0 ·

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for Data

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl DerefMut for Data

fn deref_mut(&mut self) -> &mut ::Target ⓘ

Mutably dereferences the value.

impl PartialEq for Data

fn eq(&self, other: &Data) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl Read for Data

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more1.36.0 ·

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)Determines if this Reader has an efficient read_vectoredimplementation. Read more1.0.0 ·

fn read_to_end(&mut self, buf: &mut Vec) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more1.0.0 ·

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more1.6.0 ·

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)Pull some bytes from this source into the specified buffer. Read more

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)Reads the exact number of bytes required to fill cursor. Read more1.0.0 ·

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more1.0.0 ·

fn bytes(self) -> Byteswhere Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more1.0.0 ·

fn chain(self, next: R) -> Chain<Self, R>where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more1.0.0 ·

fn take(self, limit: u64) -> Takewhere Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more

impl WireFormat for Data

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Data, Error>where R: Read,

Decodes Self from reader.

impl Deref for Data

type Target = Vec

The resulting type after dereferencing.

fn deref(&self) -> &::Target ⓘ

Dereferences the value.

impl Eq for Data

impl StructuralPartialEq for Data

Auto Trait Implementations

impl Freeze for Data

impl RefUnwindSafe for Data

impl Send for Data

impl Sync for Data

impl Unpin for Data

impl UnwindSafe for Data

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl CloneToUninit for Twhere T: Clone,

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)Performs copy-assignment from self to dst. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<P, T> Receiver for Pwhere P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)The target type on which the method may be called.

impl ToOwned for Twhere T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude

Struct Frame

pub struct Frame<T>where
    T: Framer,{
    pub tag: u16,
    pub msg: T,
}

Fields

tag: u16``msg: T

Trait Implementations

impl

Encoder<Frame<

::Request>> for ClientCodec

where P: Protocol,

type Error = Error

The type of encoding errors. Read more

fn encode( &mut self, item: Frame<

::Request>, dst: &mut BytesMut, ) -> Result<(), <ClientCodec

as Encoder<Frame<

::Request>>>::Error>

Encodes a frame into the buffer provided. Read more

impl

Encoder<Frame<

::Response>> for ServerCodec

where P: Protocol,

type Error = Error

The type of encoding errors. Read more

fn encode( &mut self, item: Frame<

::Response>, dst: &mut BytesMut, ) -> Result<(), <ServerCodec

as Encoder<Frame<

::Response>>>::Error>

Encodes a frame into the buffer provided. Read more

impl From<(u16, T)> for Framewhere T: Framer,

fn from(_: (u16, T)) -> Frame

Converts to this type from the input type.

impl WireFormat for Framewhere T: Framer,

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Frame, Error>where R: Read,

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Framewhere T: Freeze,

impl RefUnwindSafe for Framewhere T: RefUnwindSafe,

impl Send for Frame

impl Sync for Frame

impl Unpin for Framewhere T: Unpin,

impl UnwindSafe for Framewhere T: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude

Struct Tag

pub struct Tag(/* private fields */);

Trait Implementations

impl From for Tag

fn from(tag: u16) -> Tag

Converts to this type from the input type.

impl FromContext for Tagwhere T: WireFormat,

fn from_context(ctx: Context) -> Tag

Auto Trait Implementations

impl Freeze for Tag

impl RefUnwindSafe for Tag

impl Send for Tag

impl Sync for Tag

impl Unpin for Tag

impl UnwindSafe for Tag

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream::prelude

Trait ClientTransport

pub trait ClientTransport<P>:
    Sink<Frame<<P as Protocol>::Request>, Error = Error>
    + Stream<Item = Result<Frame<<P as Protocol>::Response>, Error>>
    + Send
    + Sync
    + Unpinwhere
    P: Protocol,{ }

Implementors

impl<P, T> ClientTransport

for Twhere P: Protocol, T: Sink<Frame<

::Request>, Error = Error> + Stream<Item = Result<Frame<

::Response>, Error>> + Send + Sync + Unpin,

jetstream::prelude

Trait Framer

pub trait Framer:
    Sized
    + Send
    + Sync {
    // Required methods
    fn message_type(&self) -> u8;
    fn byte_size(&self) -> u32;
    fn encode<W>(&self, writer: &mut W) -> Result<(), Error>
       where W: Write;
    fn decode<R>(reader: &mut R, ty: u8) -> Result<Self, Error>
       where R: Read;
}

Required Methods

fn message_type(&self) -> u8

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R, ty: u8) -> Result<Self, Error>where R: Read,

Decodes Self from reader.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream::prelude

Trait LazyStatic

pub trait LazyStatic { }

Support trait for enabling a few common operation on lazy static values.

This is implemented by each defined lazy static, and used by the free functions in this crate.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream::prelude

Trait Message

pub trait Message:
    WireFormat
    + Send
    + Sync { }

A trait representing a message that can be encoded and decoded.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

impl Message for Rframe

impl Message for Tframe

jetstream::prelude

Trait Protocol

pub trait Protocol:
    Sized
    + Send
    + Sync
    + Send
    + Sync {
    type Request: Framer;
    type Response: Framer;
    type Error: Error + Send + Sync + 'static;

    const VERSION: &'static str;

    // Required method
    fn rpc(
        &mut self,
        frame: Frame<Self::Request>,
    ) -> impl Future<Output = Result<Frame<Self::Response>, Self::Error>> + Send + Sync;
}

Defines the request and response types for the JetStream protocol.

Required Associated Constants

const VERSION: &'static str

Required Associated Types

type Request: Framer

type Response: Framer

type Error: Error + Send + Sync + 'static

Required Methods

fn rpc( &mut self, frame: FrameSelf::Request, ) -> impl Future<Output = Result<FrameSelf::Response, Self::Error>> + Send + Sync

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream::prelude

Trait ServiceTransport

pub trait ServiceTransport<P>:
    Sink<Frame<<P as Protocol>::Response>, Error = <P as Protocol>::Error>
    + Stream<Item = Result<Frame<<P as Protocol>::Request>, <P as Protocol>::Error>>
    + Send
    + Sync
    + Unpinwhere
    P: Protocol,{ }

Implementors

impl<P, T> ServiceTransport

for Twhere P: Protocol, T: Sink<Frame<

::Response>, Error =

::Error> + Stream<Item = Result<Frame<

::Request>,

::Error>> + Send + Sync + Unpin,

jetstream::prelude

Trait WireFormat

pub trait WireFormat: Sized + Send {
    // Required methods
    fn byte_size(&self) -> u32;
    fn encode<W>(&self, writer: &mut W) -> Result<(), Error>
       where W: Write;
    fn decode<R>(reader: &mut R) -> Result<Self, Error>
       where R: Read;
}

A type that can be encoded on the wire using the 9P protocol.

Required Methods

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

Encodes self into writer.

fn decode(reader: &mut R) -> Result<Self, Error>where R: Read,

Decodes Self from reader.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types

impl WireFormat for bool

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<bool, Error>where R: Read,

impl WireFormat for f32

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<f32, Error>where R: Read,

impl WireFormat for f64

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<f64, Error>where R: Read,

impl WireFormat for i16

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<i16, Error>where R: Read,

impl WireFormat for i32

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<i32, Error>where R: Read,

impl WireFormat for i64

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<i64, Error>where R: Read,

impl WireFormat for i128

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<i128, Error>where R: Read,

impl WireFormat for isize

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<isize, Error>where R: Read,

impl WireFormat for u8

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<u8, Error>where R: Read,

impl WireFormat for u16

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<u16, Error>where R: Read,

impl WireFormat for u32

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<u32, Error>where R: Read,

impl WireFormat for u64

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<u64, Error>where R: Read,

impl WireFormat for u128

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<u128, Error>where R: Read,

impl WireFormat for ()

fn byte_size(&self) -> u32

fn encode(&self, _writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(_reader: &mut R) -> Result<(), Error>where R: Read,

impl WireFormat for usize

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<usize, Error>where R: Read,

impl WireFormat for String

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<String, Error>where R: Read,

impl WireFormat for Ipv4Addr

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<Ipv4Addr, Error>where R: Read,

impl WireFormat for Ipv6Addr

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<Ipv6Addr, Error>where R: Read,

impl WireFormat for SocketAddrV4

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<SocketAddrV4, Error>where R: Read,

impl WireFormat for SocketAddrV6

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<SocketAddrV6, Error>where R: Read,

impl WireFormat for Optionwhere T: WireFormat,

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<Option, Error>where R: Read,

impl WireFormat for Vecwhere T: WireFormat,

fn byte_size(&self) -> u32

fn encode(&self, writer: &mut W) -> Result<(), Error>where W: Write,

fn decode(reader: &mut R) -> Result<Vec, Error>where R: Read,

Implementors

impl WireFormat for P9String

impl WireFormat for Dirent

impl WireFormat for Qid

impl WireFormat for Rattach

impl WireFormat for Rauth

impl WireFormat for Rerror

impl WireFormat for Rframe

impl WireFormat for Rgetattr

impl WireFormat for Rgetlock

impl WireFormat for Rlcreate

impl WireFormat for Rlerror

impl WireFormat for Rlock

impl WireFormat for Rlopen

impl WireFormat for Rmkdir

impl WireFormat for Rmknod

impl WireFormat for Rread

impl WireFormat for Rreaddir

impl WireFormat for Rstatfs

impl WireFormat for Rversion

impl WireFormat for Rwalk

impl WireFormat for Rwrite

impl WireFormat for Rxattrwalk

impl WireFormat for Tattach

impl WireFormat for Tauth

impl WireFormat for Tclunk

impl WireFormat for Tflush

impl WireFormat for Tframe

impl WireFormat for Tfsync

impl WireFormat for Tgetattr

impl WireFormat for Tgetlock

impl WireFormat for Tlcreate

impl WireFormat for Tlock

impl WireFormat for Tlopen

impl WireFormat for Tmkdir

impl WireFormat for Tmknod

impl WireFormat for Tread

impl WireFormat for Treaddir

impl WireFormat for Tremove

impl WireFormat for Trename

impl WireFormat for Trenameat

impl WireFormat for Tsetattr

impl WireFormat for Tstatfs

impl WireFormat for Tunlinkat

impl WireFormat for Tversion

impl WireFormat for Twalk

impl WireFormat for Twrite

impl WireFormat for Txattrcreate

impl WireFormat for Txattrwalk

impl WireFormat for Data

impl WireFormat for Framewhere T: Framer,

jetstream::prelude

Trait __Deref

1.0.0 ·

pub trait __Deref {
    type Target: ?Sized;

    // Required method
    fn deref(&self) -> &Self::Target;
}

Used for immutable dereferencing operations, like *v.

In addition to being used for explicit dereferencing operations with the (unary) * operator in immutable contexts, Deref is also used implicitly by the compiler in many circumstances. This mechanism is called “Deref coercion”. In mutable contexts, DerefMut is used and mutable deref coercion similarly occurs.

Warning: Deref coercion is a powerful language feature which has far-reaching implications for every type that implements Deref. The compiler will silently insert calls to Deref::deref. For this reason, one should be careful about implementing Deref and only do so when deref coercion is desirable. See below for advice on when this is typically desirable or undesirable.

Types that implement Deref or DerefMut are often called “smart pointers” and the mechanism of deref coercion has been specifically designed to facilitate the pointer-like behavior that name suggests. Often, the purpose of a “smart pointer” type is to change the ownership semantics of a contained value (for example, Rc or Cow) or the storage semantics of a contained value (for example, Box).

Deref coercion

If T implements Deref<Target = U>, and v is a value of type T, then:

  • In immutable contexts, *v (where T is neither a reference nor a raw pointer) is equivalent to *Deref::deref(&v).
  • Values of type &T are coerced to values of type &U
  • T implicitly implements all the methods of the type U which take the&self receiver.

For more details, visit the chapter in _The Rust Programming Language_as well as the reference sections on the dereference operator, method resolution, and type coercions.

When to implement Deref or DerefMut

The same advice applies to both deref traits. In general, deref traits should be implemented if:

  • a value of the type transparently behaves like a value of the target type;
  • the implementation of the deref function is cheap; and
  • users of the type will not be surprised by any deref coercion behavior.

In general, deref traits should not be implemented if:

  • the deref implementations could fail unexpectedly; or
  • the type has methods that are likely to collide with methods on the target type; or
  • committing to deref coercion as part of the public API is not desirable.

Note that there’s a large difference between implementing deref traits generically over many target types, and doing so only for specific target types.

Generic implementations, such as for Box<T> (which is generic over every type and dereferences to T) should be careful to provide few or no methods, since the target type is unknown and therefore every method could collide with one on the target type, causing confusion for users. impl<T> Box<T> has no methods (though several associated functions), partly for this reason.

Specific implementations, such as for String (whose Derefimplementation has Target = str) can have many methods, since avoiding collision is much easier. String and str both have many methods, and String additionally behaves as if it has every method of str because of deref coercion. The implementing type may also be generic while the implementation is still specific in this sense; for example, Vec<T>dereferences to [T], so methods of T are not applicable.

Consider also that deref coercion means that deref traits are a much larger part of a type’s public API than any other trait as it is implicitly called by the compiler. Therefore, it is advisable to consider whether this is something you are comfortable supporting as a public API.

The AsRef and Borrow traits have very similar signatures to Deref. It may be desirable to implement either or both of these, whether in addition to or rather than deref traits. See their documentation for details.

Fallibility

This trait’s method should never unexpectedly fail. Deref coercion means the compiler will often insert calls to Deref::deref implicitly. Failure during dereferencing can be extremely confusing when Deref is invoked implicitly. In the majority of uses it should be infallible, though it may be acceptable to panic if the type is misused through programmer error, for example.

However, infallibility is not enforced and therefore not guaranteed. As such, unsafe code should not rely on infallibility in general for soundness.

Examples

A struct with a single field which is accessible by dereferencing the struct.

use std::ops::Deref;

struct DerefExample<T> {
    value: T
}

impl<T> Deref for DerefExample<T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        &self.value
    }
}

let x = DerefExample { value: 'a' };
assert_eq!('a', *x);

Required Associated Types

1.0.0 ·

type Target: ?Sized

The resulting type after dereferencing.

Required Methods

1.0.0 ·

fn deref(&self) -> &Self::Target

Dereferences the value.

Implementors

impl Deref for Bytes

type Target = [u8]

impl Deref for BytesMut

type Target = [u8]

impl Deref for WakerRef<'_>

type Target = Waker

1.0.0 ·

impl Deref for CString

type Target = CStr

1.0.0 ·

impl Deref for String

type Target = str

1.0.0 ·

impl Deref for OsString

type Target = OsStr

1.0.0 ·

impl Deref for PathBuf

type Target = Path

impl Deref for Data

type Target = Vec

impl<'a> Deref for MaybeUninitSlice<'a>

type Target = [MaybeUninit]

1.36.0 ·

impl<'a> Deref for IoSlice<'a>

type Target = [u8]

1.36.0 ·

impl<'a> Deref for IoSliceMut<'a>

type Target = [u8]

impl<'a, 'f> Deref for VaList<'a, 'f>where 'f: 'a,

type Target = VaListImpl<'f>

impl<'a, R, G, T> Deref for MappedReentrantMutexGuard<'a, R, G, T>where R: RawMutex + 'a, G: GetThreadId + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, G, T> Deref for ReentrantMutexGuard<'a, R, G, T>where R: RawMutex + 'a, G: GetThreadId + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for lock_api::mutex::MappedMutexGuard<'a, R, T>where R: RawMutex + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for lock_api::mutex::MutexGuard<'a, R, T>where R: RawMutex + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for lock_api::rwlock::MappedRwLockReadGuard<'a, R, T>where R: RawRwLock + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for lock_api::rwlock::MappedRwLockWriteGuard<'a, R, T>where R: RawRwLock + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for lock_api::rwlock::RwLockReadGuard<'a, R, T>where R: RawRwLock + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for RwLockUpgradableReadGuard<'a, R, T>where R: RawRwLockUpgrade + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, R, T> Deref for lock_api::rwlock::RwLockWriteGuard<'a, R, T>where R: RawRwLock + 'a, T: 'a + ?Sized,

type Target = T

impl<'a, T> Deref for tokio::sync::mutex::MappedMutexGuard<'a, T>where T: ?Sized,

type Target = T

impl<'s> Deref for SockRef<'s>

type Target = Socket

impl Deref for SmallVecwhere A: Array,

type Target = [::Item]

1.0.0 ·

impl Deref for Cow<'_, B>where B: ToOwned + ?Sized, ::Owned: Borrow,

type Target = B

impl<B, T> Deref for zerocopy::ref::def::Ref<B, T>where B: ByteSlice, T: FromBytes + KnownLayout + Immutable + ?Sized,

type Target = T

1.33.0 ·

impl Deref for Pinwhere Ptr: Deref,

type Target = ::Target

impl Deref for BlockingStreamwhere S: Stream + Unpin,

type Target = S

1.0.0 ·

impl Deref for &Twhere T: ?Sized,

type Target = T

1.0.0 ·

impl Deref for &mut Twhere T: ?Sized,

type Target = T

impl Deref for futures_util::lock::mutex::MutexGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for futures_util::lock::mutex::OwnedMutexGuardwhere T: ?Sized,

type Target = T

impl Deref for tokio::sync::mutex::MutexGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for tokio::sync::mutex::OwnedMutexGuardwhere T: ?Sized,

type Target = T

impl Deref for OwnedRwLockWriteGuardwhere T: ?Sized,

type Target = T

impl Deref for tokio::sync::rwlock::read_guard::RwLockReadGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for tokio::sync::rwlock::write_guard::RwLockWriteGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for RwLockMappedWriteGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for tokio::sync::watch::Ref<'_, T>

type Target = T

impl Deref for Unalignwhere T: Unaligned,

type Target = T

impl Deref for ThinBoxwhere T: ?Sized,

type Target = T

1.0.0 ·

impl Deref for core::cell::Ref<'_, T>where T: ?Sized,

type Target = T

1.0.0 ·

impl Deref for RefMut<'_, T>where T: ?Sized,

type Target = T

1.20.0 ·

impl Deref for ManuallyDropwhere T: ?Sized,

type Target = T

1.9.0 ·

impl Deref for AssertUnwindSafe

type Target = T

impl Deref for std::sync::mutex::MappedMutexGuard<'_, T>where T: ?Sized,

type Target = T

1.0.0 ·

impl Deref for std::sync::mutex::MutexGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for ReentrantLockGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for std::sync::rwlock::MappedRwLockReadGuard<'_, T>where T: ?Sized,

type Target = T

impl Deref for std::sync::rwlock::MappedRwLockWriteGuard<'_, T>where T: ?Sized,

type Target = T

1.0.0 ·

impl Deref for std::sync::rwlock::RwLockReadGuard<'_, T>where T: ?Sized,

type Target = T

1.0.0 ·

impl Deref for std::sync::rwlock::RwLockWriteGuard<'_, T>where T: ?Sized,

type Target = T

1.0.0 ·

impl<T, A> Deref for Box<T, A>where A: Allocator, T: ?Sized,

type Target = T

1.12.0 ·

impl<T, A> Deref for PeekMut<'_, T, A>where T: Ord, A: Allocator,

type Target = T

1.0.0 ·

impl<T, A> Deref for Rc<T, A>where A: Allocator, T: ?Sized,

type Target = T

impl<T, A> Deref for UniqueRc<T, A>where A: Allocator, T: ?Sized,

type Target = T

1.0.0 ·

impl<T, A> Deref for Arc<T, A>where A: Allocator, T: ?Sized,

type Target = T

1.0.0 ·

impl<T, A> Deref for Vec<T, A>where A: Allocator,

type Target = [T]

1.80.0 ·

impl<T, F> Deref for LazyCell<T, F>where F: FnOnce() -> T,

type Target = T

1.80.0 ·

impl<T, F> Deref for LazyLock<T, F>where F: FnOnce() -> T,

type Target = T

impl<T, F, S> Deref for ScopeGuard<T, F, S>where F: FnOnce(T), S: Strategy,

type Target = T

impl<T, U> Deref for futures_util::lock::mutex::MappedMutexGuard<'_, T, U>where T: ?Sized, U: ?Sized,

type Target = U

impl<T, U> Deref for OwnedMappedMutexGuard<T, U>where T: ?Sized, U: ?Sized,

type Target = U

impl<T, U> Deref for OwnedRwLockReadGuard<T, U>where T: ?Sized, U: ?Sized,

type Target = U

impl<T, U> Deref for OwnedRwLockMappedWriteGuard<T, U>where T: ?Sized, U: ?Sized,

type Target = U

Crate jetstream_9p

Re-exports

  • pub use self::messages::*;:

Modules

Enums

Constants

  • DEFAULT_``MSIZE:
  • MAPPED_``FLAGS:
  • MAX_``MESSAGE_``SIZE:
  • MIN_``MESSAGE_``SIZE:
  • P9_``APPEND:
  • P9_``CREATE:
  • P9_``DIRECT:
  • P9_``DIRECTORY:
  • P9_``DSYNC:
  • P9_EXCL:
  • P9_``FASYNC:
  • P9_``GETATTR_``BASIC:
  • P9_``LARGEFILE:
  • P9_``LOCK_``SUCCESS:
  • P9_``LOCK_``TYPE_``UNLCK:
  • P9_``NOACCESS:
  • P9_``NOATIME:
  • P9_``NOCTTY:
  • P9_``NOFOLLOW:
  • P9_``NONBLOCK:
  • P9_``QTDIR:
  • P9_``QTFILE:
  • P9_``QTSYMLINK:
  • P9_``RDONLY:
  • P9_RDWR:
  • P9_``SETATTR_``ATIME:
  • P9_``SETATTR_``ATIME_``SET:
  • P9_``SETATTR_``CTIME:
  • P9_``SETATTR_``GID:
  • P9_``SETATTR_``MODE:
  • P9_``SETATTR_``MTIME:
  • P9_``SETATTR_``MTIME_``SET:
  • P9_``SETATTR_``SIZE:
  • P9_``SETATTR_``UID:
  • P9_SYNC:
  • P9_``TRUNC:
  • P9_``WRONLY:
  • _P9_``CLOEXEC:
  • _P9_``GETATTR_``ALL:
  • _P9_``GETATTR_``ATIME:
  • _P9_``GETATTR_``BLOCKS:
  • _P9_``GETATTR_``BTIME:
  • _P9_``GETATTR_``CTIME:
  • _P9_``GETATTR_``DATA_``VERSION:
  • _P9_``GETATTR_``GEN:
  • _P9_``GETATTR_``GID:
  • _P9_``GETATTR_``INO:
  • _P9_``GETATTR_``MODE:
  • _P9_``GETATTR_``MTIME:
  • _P9_``GETATTR_``NLINK:
  • _P9_``GETATTR_``RDEV:
  • _P9_``GETATTR_``SIZE:
  • _P9_``GETATTR_``UID:
  • _P9_``LOCK_``BLOCKED:
  • _P9_``LOCK_``ERROR:
  • _P9_``LOCK_``FLAGS_``BLOCK:
  • _P9_``LOCK_``FLAGS_``RECLAIM:
  • _P9_``LOCK_``GRACE:
  • _P9_``LOCK_``TYPE_``RDLCK:
  • _P9_``LOCK_``TYPE_``WRLCK:
  • _P9_``QTAPPEND:
  • _P9_``QTAUTH:
  • _P9_``QTEXCL:
  • _P9_``QTLINK:
  • _P9_``QTMOUNT:
  • _P9_``QTTMP:

Functions

  • error_``to_``rmessage:

jetstream_9p

Constant DEFAULT_MSIZE

pub const DEFAULT_MSIZE: u32 = 8192;

jetstream_9p

Constant MAPPED_FLAGS

pub const MAPPED_FLAGS: [(u32, i32); 16];

jetstream_9p

Constant MAX_MESSAGE_SIZE

pub const MAX_MESSAGE_SIZE: u32 = _; // 65_560u32

jetstream_9p

Constant MIN_MESSAGE_SIZE

pub const MIN_MESSAGE_SIZE: u32 = 256;

jetstream_9p

Constant P9_APPEND

pub const P9_APPEND: u32 = 0o00002000;

jetstream_9p

Constant P9_CREATE

pub const P9_CREATE: u32 = 0o00000100;

jetstream_9p

Constant P9_DIRECT

pub const P9_DIRECT: u32 = 0o00040000;

jetstream_9p

Constant P9_DIRECTORY

pub const P9_DIRECTORY: u32 = 0o00200000;

jetstream_9p

Constant P9_DSYNC

pub const P9_DSYNC: u32 = 0o00010000;

jetstream_9p

Constant P9_EXCL

pub const P9_EXCL: u32 = 0o00000200;

jetstream_9p

Constant P9_FASYNC

pub const P9_FASYNC: u32 = 0o00020000;

jetstream_9p

Constant P9_GETATTR_BASIC

pub const P9_GETATTR_BASIC: u64 = 0x000007ff;

jetstream_9p

Constant P9_LARGEFILE

pub const P9_LARGEFILE: u32 = 0o00100000;

jetstream_9p

Constant P9_LOCK_SUCCESS

pub const P9_LOCK_SUCCESS: u8 = 0;

jetstream_9p

Constant P9_LOCK_TYPE_UNLCK

pub const P9_LOCK_TYPE_UNLCK: u8 = 2;

jetstream_9p

Constant P9_NOACCESS

pub const P9_NOACCESS: u32 = 0o00000003;

jetstream_9p

Constant P9_NOATIME

pub const P9_NOATIME: u32 = 0o01000000;

jetstream_9p

Constant P9_NOCTTY

pub const P9_NOCTTY: u32 = 0o00000400;

jetstream_9p

Constant P9_NOFOLLOW

pub const P9_NOFOLLOW: u32 = 0o00400000;

jetstream_9p

Constant P9_NONBLOCK

pub const P9_NONBLOCK: u32 = 0o00004000;

jetstream_9p

Constant P9_QTDIR

pub const P9_QTDIR: u8 = 0x80;

jetstream_9p

Constant P9_QTFILE

pub const P9_QTFILE: u8 = 0x00;

jetstream_9p

Constant P9_QTSYMLINK

pub const P9_QTSYMLINK: u8 = 0x02;

jetstream_9p

Constant P9_RDONLY

pub const P9_RDONLY: u32 = 0o00000000;

jetstream_9p

Constant P9_RDWR

pub const P9_RDWR: u32 = 0o00000002;

jetstream_9p

Constant P9_SETATTR_ATIME

pub const P9_SETATTR_ATIME: u32 = 0x00000010;

jetstream_9p

Constant P9_SETATTR_ATIME_SET

pub const P9_SETATTR_ATIME_SET: u32 = 0x00000080;

jetstream_9p

Constant P9_SETATTR_CTIME

pub const P9_SETATTR_CTIME: u32 = 0x00000040;

jetstream_9p

Constant P9_SETATTR_GID

pub const P9_SETATTR_GID: u32 = 0x00000004;

jetstream_9p

Constant P9_SETATTR_MODE

pub const P9_SETATTR_MODE: u32 = 0x00000001;

jetstream_9p

Constant P9_SETATTR_MTIME

pub const P9_SETATTR_MTIME: u32 = 0x00000020;

jetstream_9p

Constant P9_SETATTR_MTIME_SET

pub const P9_SETATTR_MTIME_SET: u32 = 0x00000100;

jetstream_9p

Constant P9_SETATTR_SIZE

pub const P9_SETATTR_SIZE: u32 = 0x00000008;

jetstream_9p

Constant P9_SETATTR_UID

pub const P9_SETATTR_UID: u32 = 0x00000002;

jetstream_9p

Constant P9_SYNC

pub const P9_SYNC: u32 = 0o04000000;

jetstream_9p

Constant P9_TRUNC

pub const P9_TRUNC: u32 = 0o00001000;

jetstream_9p

Constant P9_WRONLY

pub const P9_WRONLY: u32 = 0o00000001;

jetstream_9p

Constant _P9_CLOEXEC

pub const _P9_CLOEXEC: u32 = 0o02000000;

jetstream_9p

Constant _P9_GETATTR_ALL

pub const _P9_GETATTR_ALL: u64 = 0x00003fff;

jetstream_9p

Constant _P9_GETATTR_ATIME

pub const _P9_GETATTR_ATIME: u64 = 0x00000020;

jetstream_9p

Constant _P9_GETATTR_BLOCKS

pub const _P9_GETATTR_BLOCKS: u64 = 0x00000400;

jetstream_9p

Constant _P9_GETATTR_BTIME

pub const _P9_GETATTR_BTIME: u64 = 0x00000800;

jetstream_9p

Constant _P9_GETATTR_CTIME

pub const _P9_GETATTR_CTIME: u64 = 0x00000080;

jetstream_9p

Constant _P9_GETATTR_DATA_VERSION

pub const _P9_GETATTR_DATA_VERSION: u64 = 0x00002000;

jetstream_9p

Constant _P9_GETATTR_GEN

pub const _P9_GETATTR_GEN: u64 = 0x00001000;

jetstream_9p

Constant _P9_GETATTR_GID

pub const _P9_GETATTR_GID: u64 = 0x00000008;

jetstream_9p

Constant _P9_GETATTR_INO

pub const _P9_GETATTR_INO: u64 = 0x00000100;

jetstream_9p

Constant _P9_GETATTR_MODE

pub const _P9_GETATTR_MODE: u64 = 0x00000001;

jetstream_9p

Constant _P9_GETATTR_MTIME

pub const _P9_GETATTR_MTIME: u64 = 0x00000040;

jetstream_9p

Constant _P9_GETATTR_NLINK

pub const _P9_GETATTR_NLINK: u64 = 0x00000002;

jetstream_9p

Constant _P9_GETATTR_RDEV

pub const _P9_GETATTR_RDEV: u64 = 0x00000010;

jetstream_9p

Constant _P9_GETATTR_SIZE

pub const _P9_GETATTR_SIZE: u64 = 0x00000200;

jetstream_9p

Constant _P9_GETATTR_UID

pub const _P9_GETATTR_UID: u64 = 0x00000004;

jetstream_9p

Constant _P9_LOCK_BLOCKED

pub const _P9_LOCK_BLOCKED: u8 = 1;

jetstream_9p

Constant _P9_LOCK_ERROR

pub const _P9_LOCK_ERROR: u8 = 2;

jetstream_9p

Constant _P9_LOCK_FLAGS_BLOCK

pub const _P9_LOCK_FLAGS_BLOCK: u8 = 1;

jetstream_9p

Constant _P9_LOCK_FLAGS_RECLAIM

pub const _P9_LOCK_FLAGS_RECLAIM: u8 = 2;

jetstream_9p

Constant _P9_LOCK_GRACE

pub const _P9_LOCK_GRACE: u8 = 3;

jetstream_9p

Constant _P9_LOCK_TYPE_RDLCK

pub const _P9_LOCK_TYPE_RDLCK: u8 = 0;

jetstream_9p

Constant _P9_LOCK_TYPE_WRLCK

pub const _P9_LOCK_TYPE_WRLCK: u8 = 1;

jetstream_9p

Constant _P9_QTAPPEND

pub const _P9_QTAPPEND: u8 = 0x40;

jetstream_9p

Constant _P9_QTAUTH

pub const _P9_QTAUTH: u8 = 0x08;

jetstream_9p

Constant _P9_QTEXCL

pub const _P9_QTEXCL: u8 = 0x20;

jetstream_9p

Constant _P9_QTLINK

pub const _P9_QTLINK: u8 = 0x01;

jetstream_9p

Constant _P9_QTMOUNT

pub const _P9_QTMOUNT: u8 = 0x10;

jetstream_9p

Constant _P9_QTTMP

pub const _P9_QTTMP: u8 = 0x04;

jetstream_9p

Enum Version

pub enum Version {
    V9P2000 = 0,
    V9P2000U = 1,
    V9P2000L = 2,
    V9P2000Lu = 3,
    V9P2024q9p = 4,
}

Variants

V9P2000 = 0

V9P2000U = 1

V9P2000L = 2

V9P2000Lu = 3

V9P2024q9p = 4

Trait Implementations

impl From<&str> for Version

fn from(version: &str) -> Self

Converts to this type from the input type.

impl From for Version

fn from(version: String) -> Self

Converts to this type from the input type.

impl From for &str

fn from(val: Version) -> Self

Converts to this type from the input type.

impl From for String

fn from(val: Version) -> Self

Converts to this type from the input type.

Auto Trait Implementations

impl Freeze for Version

impl RefUnwindSafe for Version

impl Send for Version

impl Sync for Version

impl Unpin for Version

impl UnwindSafe for Version

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p

Function error_to_rmessage

pub fn error_to_rmessage(err: &Error) -> Rlerror

jetstream_9p

Module messages

Structs

Enums

  • Rmessage: A message sent from a 9P server to a 9P client in response to a request from that client. Encapsulates a full frame.
  • Tmessage: A message sent from a 9P client to a 9P server.

jetstream_9p::messages

Enum Rmessage

pub enum Rmessage {
    Version(Rversion),
    Flush,
    Walk(Rwalk),
    Read(Rread),
    Write(Rwrite),
    Clunk,
    Remove,
    Attach(Rattach),
    Auth(Rauth),
    Statfs(Rstatfs),
    Lopen(Rlopen),
    Lcreate(Rlcreate),
    Symlink(Rsymlink),
    Mknod(Rmknod),
    Rename,
    Readlink(Rreadlink),
    GetAttr(Rgetattr),
    SetAttr,
    XattrWalk(Rxattrwalk),
    XattrCreate,
    Readdir(Rreaddir),
    Fsync,
    Lock(Rlock),
    GetLock(Rgetlock),
    Link,
    Mkdir(Rmkdir),
    RenameAt,
    UnlinkAt,
    Lerror(Rlerror),
}

A message sent from a 9P server to a 9P client in response to a request from that client. Encapsulates a full frame.

Variants

Version(Rversion)

Flush

Walk(Rwalk)

Read(Rread)

Write(Rwrite)

Clunk

Remove

Attach(Rattach)

Auth(Rauth)

Statfs(Rstatfs)

Lopen(Rlopen)

Lcreate(Rlcreate)

Mknod(Rmknod)

Rename

GetAttr(Rgetattr)

SetAttr

XattrWalk(Rxattrwalk)

XattrCreate

Readdir(Rreaddir)

Fsync

Lock(Rlock)

GetLock(Rgetlock)

Mkdir(Rmkdir)

RenameAt

UnlinkAt

Lerror(Rlerror)

Trait Implementations

impl Debug for Rmessage

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Freeze for Rmessage

impl RefUnwindSafe for Rmessage

impl Send for Rmessage

impl Sync for Rmessage

impl Unpin for Rmessage

impl UnwindSafe for Rmessage

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Enum Tmessage

#[repr(u8)]pub enum Tmessage {
    Version(Tversion),
    Flush(Tflush),
    Walk(Twalk),
    Read(Tread),
    Write(Twrite),
    Clunk(Tclunk),
    Remove(Tremove),
    Attach(Tattach),
    Auth(Tauth),
    Statfs(Tstatfs),
    Lopen(Tlopen),
    Lcreate(Tlcreate),
    Symlink(Tsymlink),
    Mknod(Tmknod),
    Rename(Trename),
    Readlink(Treadlink),
    GetAttr(Tgetattr),
    SetAttr(Tsetattr),
    XattrWalk(Txattrwalk),
    XattrCreate(Txattrcreate),
    Readdir(Treaddir),
    Fsync(Tfsync),
    Lock(Tlock),
    GetLock(Tgetlock),
    Link(Tlink),
    Mkdir(Tmkdir),
    RenameAt(Trenameat),
    UnlinkAt(Tunlinkat),
}

A message sent from a 9P client to a 9P server.

Variants

Version(Tversion)

Flush(Tflush)

Walk(Twalk)

Read(Tread)

Write(Twrite)

Clunk(Tclunk)

Remove(Tremove)

Attach(Tattach)

Auth(Tauth)

Statfs(Tstatfs)

Lopen(Tlopen)

Lcreate(Tlcreate)

Mknod(Tmknod)

Rename(Trename)

GetAttr(Tgetattr)

SetAttr(Tsetattr)

XattrWalk(Txattrwalk)

XattrCreate(Txattrcreate)

Readdir(Treaddir)

Fsync(Tfsync)

Lock(Tlock)

GetLock(Tgetlock)

Mkdir(Tmkdir)

RenameAt(Trenameat)

UnlinkAt(Tunlinkat)

Trait Implementations

impl Debug for Tmessage

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Freeze for Tmessage

impl RefUnwindSafe for Tmessage

impl Send for Tmessage

impl Sync for Tmessage

impl Unpin for Tmessage

impl UnwindSafe for Tmessage

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Dirent

pub struct Dirent {
    pub qid: Qid,
    pub offset: u64,
    pub ty: u8,
    pub name: String,
}

Dirent – directory entry

Fields

qid: Qid``offset: u64``ty: u8``name: String

Trait Implementations

impl Debug for Dirent

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Dirent

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Dirent

impl RefUnwindSafe for Dirent

impl Send for Dirent

impl Sync for Dirent

impl Unpin for Dirent

impl UnwindSafe for Dirent

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Qid

pub struct Qid {
    pub ty: u8,
    pub version: u32,
    pub path: u64,
}

Qid

Fields

ty: u8``version: u32``path: u64

Trait Implementations

impl Clone for Qid

fn clone(&self) -> Qid

Returns a copy of the value. Read more1.0.0 ·

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for Qid

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl From for Qid

fn from(st: stat64) -> Qid

Converts to this type from the input type.

impl Hash for Qid

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more1.3.0 ·

fn hash_slice(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq for Qid

fn eq(&self, other: &Qid) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl WireFormat for Qid

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

impl Copy for Qid

impl Eq for Qid

impl StructuralPartialEq for Qid

Auto Trait Implementations

impl Freeze for Qid

impl RefUnwindSafe for Qid

impl Send for Qid

impl Sync for Qid

impl Unpin for Qid

impl UnwindSafe for Qid

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl CloneToUninit for Twhere T: Clone,

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)Performs copy-assignment from self to dst. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl ToOwned for Twhere T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rattach

pub struct Rattach {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rattach

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rattach

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rattach

impl RefUnwindSafe for Rattach

impl Send for Rattach

impl Sync for Rattach

impl Unpin for Rattach

impl UnwindSafe for Rattach

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rauth

pub struct Rauth {
    pub aqid: Qid,
}

Fields

aqid: Qid

Trait Implementations

impl Debug for Rauth

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rauth

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rauth

impl RefUnwindSafe for Rauth

impl Send for Rauth

impl Sync for Rauth

impl Unpin for Rauth

impl UnwindSafe for Rauth

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rerror

pub struct Rerror {
    pub ename: String,
}

Fields

ename: String

Trait Implementations

impl Debug for Rerror

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rerror

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rerror

impl RefUnwindSafe for Rerror

impl Send for Rerror

impl Sync for Rerror

impl Unpin for Rerror

impl UnwindSafe for Rerror

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rframe

pub struct Rframe {
    pub tag: u16,
    pub msg: Rmessage,
}

Fields

tag: u16``msg: Rmessage

Trait Implementations

impl Debug for Rframe

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rframe

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R) -> Result

Decodes Self from reader.

impl Message for Rframe

Auto Trait Implementations

impl Freeze for Rframe

impl RefUnwindSafe for Rframe

impl Send for Rframe

impl Sync for Rframe

impl Unpin for Rframe

impl UnwindSafe for Rframe

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rgetattr

pub struct Rgetattr {
    pub valid: u64,
    pub qid: Qid,
    pub mode: u32,
    pub uid: u32,
    pub gid: u32,
    pub nlink: u64,
    pub rdev: u64,
    pub size: u64,
    pub blksize: u64,
    pub blocks: u64,
    pub atime_sec: u64,
    pub atime_nsec: u64,
    pub mtime_sec: u64,
    pub mtime_nsec: u64,
    pub ctime_sec: u64,
    pub ctime_nsec: u64,
    pub btime_sec: u64,
    pub btime_nsec: u64,
    pub gen: u64,
    pub data_version: u64,
}

Fields

valid: u64``qid: Qid``mode: u32``uid: u32``gid: u32``nlink: u64``rdev: u64``size: u64``blksize: u64``blocks: u64``atime_sec: u64``atime_nsec: u64``mtime_sec: u64``mtime_nsec: u64``ctime_sec: u64``ctime_nsec: u64``btime_sec: u64``btime_nsec: u64``gen: u64``data_version: u64

Trait Implementations

impl Debug for Rgetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rgetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rgetattr

impl RefUnwindSafe for Rgetattr

impl Send for Rgetattr

impl Sync for Rgetattr

impl Unpin for Rgetattr

impl UnwindSafe for Rgetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rgetlock

pub struct Rgetlock {
    pub type_: u8,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

Fields

type_: u8``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Rgetlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rgetlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rgetlock

impl RefUnwindSafe for Rgetlock

impl Send for Rgetlock

impl Sync for Rgetlock

impl Unpin for Rgetlock

impl UnwindSafe for Rgetlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rlcreate

pub struct Rlcreate {
    pub qid: Qid,
    pub iounit: u32,
}

Fields

qid: Qid``iounit: u32

Trait Implementations

impl Debug for Rlcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rlcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlcreate

impl RefUnwindSafe for Rlcreate

impl Send for Rlcreate

impl Sync for Rlcreate

impl Unpin for Rlcreate

impl UnwindSafe for Rlcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rlerror

pub struct Rlerror {
    pub ecode: u32,
}

Fields

ecode: u32

Trait Implementations

impl Debug for Rlerror

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rlerror

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlerror

impl RefUnwindSafe for Rlerror

impl Send for Rlerror

impl Sync for Rlerror

impl Unpin for Rlerror

impl UnwindSafe for Rlerror

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rlock

pub struct Rlock {
    pub status: u8,
}

Fields

status: u8

Trait Implementations

impl Debug for Rlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlock

impl RefUnwindSafe for Rlock

impl Send for Rlock

impl Sync for Rlock

impl Unpin for Rlock

impl UnwindSafe for Rlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rlopen

pub struct Rlopen {
    pub qid: Qid,
    pub iounit: u32,
}

Fields

qid: Qid``iounit: u32

Trait Implementations

impl Debug for Rlopen

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rlopen

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rlopen

impl RefUnwindSafe for Rlopen

impl Send for Rlopen

impl Sync for Rlopen

impl Unpin for Rlopen

impl UnwindSafe for Rlopen

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rmkdir

pub struct Rmkdir {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rmkdir

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rmkdir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rmkdir

impl RefUnwindSafe for Rmkdir

impl Send for Rmkdir

impl Sync for Rmkdir

impl Unpin for Rmkdir

impl UnwindSafe for Rmkdir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rmknod

pub struct Rmknod {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

impl Debug for Rmknod

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rmknod

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rmknod

impl RefUnwindSafe for Rmknod

impl Send for Rmknod

impl Sync for Rmknod

impl Unpin for Rmknod

impl UnwindSafe for Rmknod

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rread

pub struct Rread {
    pub data: Data,
}

Fields

data: Data

Trait Implementations

impl Debug for Rread

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rread

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rread

impl RefUnwindSafe for Rread

impl Send for Rread

impl Sync for Rread

impl Unpin for Rread

impl UnwindSafe for Rread

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rreaddir

pub struct Rreaddir {
    pub data: Data,
}

Fields

data: Data

Trait Implementations

impl Debug for Rreaddir

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rreaddir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rreaddir

impl RefUnwindSafe for Rreaddir

impl Send for Rreaddir

impl Sync for Rreaddir

impl Unpin for Rreaddir

impl UnwindSafe for Rreaddir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rreadlink

pub struct Rreadlink {
    pub target: String,
}

Fields

target: String

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rstatfs

pub struct Rstatfs {
    pub ty: u32,
    pub bsize: u32,
    pub blocks: u64,
    pub bfree: u64,
    pub bavail: u64,
    pub files: u64,
    pub ffree: u64,
    pub fsid: u64,
    pub namelen: u32,
}

Fields

ty: u32``bsize: u32``blocks: u64``bfree: u64``bavail: u64``files: u64``ffree: u64``fsid: u64``namelen: u32

Trait Implementations

impl Debug for Rstatfs

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rstatfs

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rstatfs

impl RefUnwindSafe for Rstatfs

impl Send for Rstatfs

impl Sync for Rstatfs

impl Unpin for Rstatfs

impl UnwindSafe for Rstatfs

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rsymlink

pub struct Rsymlink {
    pub qid: Qid,
}

Fields

qid: Qid

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rversion

pub struct Rversion {
    pub msize: u32,
    pub version: String,
}

Fields

msize: u32``version: String

Trait Implementations

impl Debug for Rversion

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rversion

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rversion

impl RefUnwindSafe for Rversion

impl Send for Rversion

impl Sync for Rversion

impl Unpin for Rversion

impl UnwindSafe for Rversion

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rwalk

pub struct Rwalk {
    pub wqids: Vec<Qid>,
}

Fields

wqids: Vec<Qid>

Trait Implementations

impl Debug for Rwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rwalk

impl RefUnwindSafe for Rwalk

impl Send for Rwalk

impl Sync for Rwalk

impl Unpin for Rwalk

impl UnwindSafe for Rwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rwrite

pub struct Rwrite {
    pub count: u32,
}

Fields

count: u32

Trait Implementations

impl Debug for Rwrite

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rwrite

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rwrite

impl RefUnwindSafe for Rwrite

impl Send for Rwrite

impl Sync for Rwrite

impl Unpin for Rwrite

impl UnwindSafe for Rwrite

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Rxattrwalk

pub struct Rxattrwalk {
    pub size: u64,
}

Fields

size: u64

Trait Implementations

impl Debug for Rxattrwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Rxattrwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Rxattrwalk

impl RefUnwindSafe for Rxattrwalk

impl Send for Rxattrwalk

impl Sync for Rxattrwalk

impl Unpin for Rxattrwalk

impl UnwindSafe for Rxattrwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tattach

pub struct Tattach {
    pub fid: u32,
    pub afid: u32,
    pub uname: String,
    pub aname: String,
    pub n_uname: u32,
}

attach – attach to a file tree

size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s]
size[4] Rattach tag[2] qid[13]

attach associates the fid with the file tree rooted at aname.

Fields

fid: u32``afid: u32``uname: String``aname: String``n_uname: u32

Trait Implementations

impl Debug for Tattach

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tattach

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tattach

impl RefUnwindSafe for Tattach

impl Send for Tattach

impl Sync for Tattach

impl Unpin for Tattach

impl UnwindSafe for Tattach

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tauth

pub struct Tauth {
    pub afid: u32,
    pub uname: String,
    pub aname: String,
    pub n_uname: u32,
}

auth – authenticate a user

size[4] Tauth tag[2] afid[4] uname[s] aname[s]
size[4] Rauth tag[2] aqid[13]

auth authenticates the user named uname to access the file tree with the root named aname.

afid is used as the fid in the attach message that follows auth.

Fields

afid: u32``uname: String``aname: String``n_uname: u32

Trait Implementations

impl Debug for Tauth

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tauth

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tauth

impl RefUnwindSafe for Tauth

impl Send for Tauth

impl Sync for Tauth

impl Unpin for Tauth

impl UnwindSafe for Tauth

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tclunk

pub struct Tclunk {
    pub fid: u32,
}

clunk – remove fid

size[4] Tclunk tag[2] fid[4]
size[4] Rclunk tag[2]

clunk removes the fid from the fid table.

See the Plan 9 manual page for clunk(5).

Fields

fid: u32

Trait Implementations

impl Debug for Tclunk

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tclunk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tclunk

impl RefUnwindSafe for Tclunk

impl Send for Tclunk

impl Sync for Tclunk

impl Unpin for Tclunk

impl UnwindSafe for Tclunk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tflush

pub struct Tflush {
    pub oldtag: u16,
}

flush – abort a message

size[4] Tflush tag[2] oldtag[2]
size[4] Rflush tag[2]

flush aborts an in-flight request referenced by oldtag, if any.

See the Plan 9 manual page for flush(5).

Fields

oldtag: u16

Trait Implementations

impl Debug for Tflush

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tflush

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tflush

impl RefUnwindSafe for Tflush

impl Send for Tflush

impl Sync for Tflush

impl Unpin for Tflush

impl UnwindSafe for Tflush

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tframe

pub struct Tframe {
    pub tag: u16,
    pub msg: Result<Tmessage>,
}

Fields

tag: u16``msg: Result<Tmessage>

Trait Implementations

impl Debug for Tframe

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tframe

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R) -> Result

Decodes Self from reader.

impl Message for Tframe

Auto Trait Implementations

impl Freeze for Tframe

impl !RefUnwindSafe for Tframe

impl Send for Tframe

impl Sync for Tframe

impl Unpin for Tframe

impl !UnwindSafe for Tframe

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tfsync

pub struct Tfsync {
    pub fid: u32,
    pub datasync: u32,
}

fsync – synchronize file

size[4] Tfsync tag[2] fid[4] datasync[4]
size[4] Rfsync tag[2]

fsync flushes any cached data and metadata for the file represented by fid to stable storage.

Fields

fid: u32``datasync: u32

Trait Implementations

impl Debug for Tfsync

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tfsync

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tfsync

impl RefUnwindSafe for Tfsync

impl Send for Tfsync

impl Sync for Tfsync

impl Unpin for Tfsync

impl UnwindSafe for Tfsync

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tgetattr

pub struct Tgetattr {
    pub fid: u32,
    pub request_mask: u64,
}

getattr – get file attributes

size[4] Tgetattr tag[2] fid[4] request_mask[8]
size[4] Rgetattr tag[2] valid[8] qid[13] mode[4] uid[4] gid[4] nlink[8]
    rdev[8] size[8] blksize[8] blocks[8] atime_sec[8] atime_nsec[8]
    mtime_sec[8] mtime_nsec[8] ctime_sec[8] ctime_nsec[8] btime_sec[8]
    btime_nsec[8] gen[8] data_version[8]

getattr gets attributes of the file system object represented by fid.

Fields

fid: u32``request_mask: u64

Trait Implementations

impl Debug for Tgetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tgetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tgetattr

impl RefUnwindSafe for Tgetattr

impl Send for Tgetattr

impl Sync for Tgetattr

impl Unpin for Tgetattr

impl UnwindSafe for Tgetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tgetlock

pub struct Tgetlock {
    pub fid: u32,
    pub type_: u8,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

getlock – test for the existence of a POSIX record lock

size[4] Tgetlock tag[2] fid[4] type[1] start[8] length[8] proc_id[4] client_id[s]
size[4] Rgetlock tag[2] type[1] start[8] length[8] proc_id[4] client_id[s]

getlock tests for the existence of a POSIX record lock on the open file fid.

See the Plan 9 manual page for getlock(5).

Fields

fid: u32``type_: u8``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Tgetlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tgetlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tgetlock

impl RefUnwindSafe for Tgetlock

impl Send for Tgetlock

impl Sync for Tgetlock

impl Unpin for Tgetlock

impl UnwindSafe for Tgetlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tlcreate

pub struct Tlcreate {
    pub fid: u32,
    pub name: String,
    pub flags: u32,
    pub mode: u32,
    pub gid: u32,
}

lcreate – create a file

size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]
size[4] Rlcreate tag[2] qid[13] iounit[4]

lcreate creates a new file name in the directory represented by fid and prepares it for I/O. The flags field has the standard open(2) values.

Fields

fid: u32``name: String``flags: u32``mode: u32``gid: u32

Trait Implementations

impl Debug for Tlcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tlcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlcreate

impl RefUnwindSafe for Tlcreate

impl Send for Tlcreate

impl Sync for Tlcreate

impl Unpin for Tlcreate

impl UnwindSafe for Tlcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tlink

pub struct Tlink {
    pub dfid: u32,
    pub fid: u32,
    pub name: String,
}

link – create hard link

size[4] Tlink tag[2] dfid[4] fid[4] name[s]
size[4] Rlink tag[2]

link creates a new hard link name in the directory dfid that refers to the same file as fid.

Fields

dfid: u32``fid: u32``name: String

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tlock

pub struct Tlock {
    pub fid: u32,
    pub type_: u8,
    pub flags: u32,
    pub start: u64,
    pub length: u64,
    pub proc_id: u32,
    pub client_id: String,
}

lock – acquire or release a POSIX record lock

size[4] Tlock tag[2] fid[4] type[1] flags[4] start[8] length[8] proc_id[4] client_id[s]
size[4] Rlock tag[2] status[1]

lock acquires or releases a POSIX record lock on the open file fid.

See the Plan 9 manual page for lock(5).

Fields

fid: u32``type_: u8``flags: u32``start: u64``length: u64``proc_id: u32``client_id: String

Trait Implementations

impl Debug for Tlock

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tlock

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlock

impl RefUnwindSafe for Tlock

impl Send for Tlock

impl Sync for Tlock

impl Unpin for Tlock

impl UnwindSafe for Tlock

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tlopen

pub struct Tlopen {
    pub fid: u32,
    pub flags: u32,
}

lopen – open a file

size[4] Tlopen tag[2] fid[4] flags[4]
size[4] Rlopen tag[2] qid[13] iounit[4]

lopen prepares fid for file I/O. The flags field has the standard open(2) values.

Fields

fid: u32``flags: u32

Trait Implementations

impl Debug for Tlopen

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tlopen

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tlopen

impl RefUnwindSafe for Tlopen

impl Send for Tlopen

impl Sync for Tlopen

impl Unpin for Tlopen

impl UnwindSafe for Tlopen

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tmkdir

pub struct Tmkdir {
    pub dfid: u32,
    pub name: String,
    pub mode: u32,
    pub gid: u32,
}

mkdir – create directory

size[4] Tmkdir tag[2] dfid[4] name[s] mode[4] gid[4]
size[4] Rmkdir tag[2] qid[13]

mkdir creates a new directory name in the directory represented by dfid.

Fields

dfid: u32``name: String``mode: u32``gid: u32

Trait Implementations

impl Debug for Tmkdir

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tmkdir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tmkdir

impl RefUnwindSafe for Tmkdir

impl Send for Tmkdir

impl Sync for Tmkdir

impl Unpin for Tmkdir

impl UnwindSafe for Tmkdir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tmknod

pub struct Tmknod {
    pub dfid: u32,
    pub name: String,
    pub mode: u32,
    pub major: u32,
    pub minor: u32,
    pub gid: u32,
}

mknod – create a special file

size[4] Tmknod tag[2] dfid[4] name[s] mode[4] major[4] minor[4] gid[4]
size[4] Rmknod tag[2] qid[13]

mknod creates a new special file name in the directory represented by dfid.

Fields

dfid: u32``name: String``mode: u32``major: u32``minor: u32``gid: u32

Trait Implementations

impl Debug for Tmknod

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tmknod

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tmknod

impl RefUnwindSafe for Tmknod

impl Send for Tmknod

impl Sync for Tmknod

impl Unpin for Tmknod

impl UnwindSafe for Tmknod

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tread

pub struct Tread {
    pub fid: u32,
    pub offset: u64,
    pub count: u32,
}

read – read data from a file

size[4] Tread tag[2] fid[4] offset[8] count[4]
size[4] Rread tag[2] count[4] data[count]

read performs I/O on the file represented by fid.

Under 9P2000.L, read cannot be used on directories. See Treaddir for reading directories.

See the Plan 9 manual page for read(5).

Fields

fid: u32``offset: u64``count: u32

Trait Implementations

impl Debug for Tread

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tread

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tread

impl RefUnwindSafe for Tread

impl Send for Tread

impl Sync for Tread

impl Unpin for Tread

impl UnwindSafe for Tread

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Treaddir

pub struct Treaddir {
    pub fid: u32,
    pub offset: u64,
    pub count: u32,
}

readdir – read directory entries

size[4] Treaddir tag[2] fid[4] offset[8] count[4]
size[4] Rreaddir tag[2] count[4] data[count]

readdir reads directory entries from the directory represented by fid.

Fields

fid: u32``offset: u64``count: u32

Trait Implementations

impl Debug for Treaddir

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Treaddir

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Treaddir

impl RefUnwindSafe for Treaddir

impl Send for Treaddir

impl Sync for Treaddir

impl Unpin for Treaddir

impl UnwindSafe for Treaddir

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Treadlink

pub struct Treadlink {
    pub fid: u32,
}

readlink – read symlink value

size[4] Treadlink tag[2] fid[4]
size[4] Rreadlink tag[2] target[s]

readlink reads the target of the symbolic link represented by fid.

Fields

fid: u32

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tremove

pub struct Tremove {
    pub fid: u32,
}

remove – remove a file

size[4] Tremove tag[2] fid[4]
size[4] Rremove tag[2]

remove removes the file represented by fid.

See the Plan 9 manual page for remove(5).

Fields

fid: u32

Trait Implementations

impl Debug for Tremove

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tremove

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tremove

impl RefUnwindSafe for Tremove

impl Send for Tremove

impl Sync for Tremove

impl Unpin for Tremove

impl UnwindSafe for Tremove

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Trename

pub struct Trename {
    pub fid: u32,
    pub dfid: u32,
    pub name: String,
}

rename – rename a file

size[4] Trename tag[2] fid[4] dfid[4] name[s]
size[4] Rrename tag[2]

rename renames a file or directory from old name to new name in the directory represented by dfid. fid represents the file to be renamed.

Fields

fid: u32``dfid: u32``name: String

Trait Implementations

impl Debug for Trename

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Trename

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Trename

impl RefUnwindSafe for Trename

impl Send for Trename

impl Sync for Trename

impl Unpin for Trename

impl UnwindSafe for Trename

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Trenameat

pub struct Trenameat {
    pub olddirfid: u32,
    pub oldname: String,
    pub newdirfid: u32,
    pub newname: String,
}

renameat – rename a file or directory

size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s]
size[4] Rrenameat tag[2]

renameat renames a file or directory from oldname in the directory represented by olddirfid to newname in the directory represented by newdirfid.

Fields

olddirfid: u32``oldname: String``newdirfid: u32``newname: String

Trait Implementations

impl Debug for Trenameat

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Trenameat

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Trenameat

impl RefUnwindSafe for Trenameat

impl Send for Trenameat

impl Sync for Trenameat

impl Unpin for Trenameat

impl UnwindSafe for Trenameat

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tsetattr

pub struct Tsetattr {
    pub fid: u32,
    pub valid: u32,
    pub mode: u32,
    pub uid: u32,
    pub gid: u32,
    pub size: u64,
    pub atime_sec: u64,
    pub atime_nsec: u64,
    pub mtime_sec: u64,
    pub mtime_nsec: u64,
}

setattr – set file attributes

size[4] Tsetattr tag[2] fid[4] valid[4] mode[4] uid[4] gid[4] size[8]
    atime_sec[8] atime_nsec[8] mtime_sec[8] mtime_nsec[8]
size[4] Rsetattr tag[2]

setattr sets attributes of the file system object represented by fid.

Fields

fid: u32``valid: u32``mode: u32``uid: u32``gid: u32``size: u64``atime_sec: u64``atime_nsec: u64``mtime_sec: u64``mtime_nsec: u64

Trait Implementations

impl Debug for Tsetattr

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tsetattr

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tsetattr

impl RefUnwindSafe for Tsetattr

impl Send for Tsetattr

impl Sync for Tsetattr

impl Unpin for Tsetattr

impl UnwindSafe for Tsetattr

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tstatfs

pub struct Tstatfs {
    pub fid: u32,
}

statfs – get file system information

size[4] Tstatfs tag[2] fid[4]
size[4] Rstatfs tag[2] type[4] bsize[4] blocks[8] bfree[8] bavail[8]
                       files[8] ffree[8] fsid[8] namelen[4]

statfs is used to request file system information of the file system containing fid. The Rstatfs response corresponds to the fields returned by the statfs(2) system call.

Fields

fid: u32

Trait Implementations

impl Debug for Tstatfs

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tstatfs

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tstatfs

impl RefUnwindSafe for Tstatfs

impl Send for Tstatfs

impl Sync for Tstatfs

impl Unpin for Tstatfs

impl UnwindSafe for Tstatfs

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tsymlink

pub struct Tsymlink {
    pub fid: u32,
    pub name: String,
    pub symtgt: String,
    pub gid: u32,
}

symlink – create symlink

size[4] Tsymlink tag[2] fid[4] name[s] symtgt[s] gid[4]
size[4] Rsymlink tag[2] qid[13]

symlink creates a new symbolic link name in the directory represented by fid.

Fields

fid: u32``name: String``symtgt: String``gid: u32

Trait Implementations

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tunlinkat

pub struct Tunlinkat {
    pub dirfd: u32,
    pub name: String,
    pub flags: u32,
}

unlinkat – unlink a file or directory

size[4] Tunlinkat tag[2] dirfd[4] name[s] flags[4]
size[4] Runlinkat tag[2]

unlinkat removes the file name from the directory represented by dirfd.

Fields

dirfd: u32``name: String``flags: u32

Trait Implementations

impl Debug for Tunlinkat

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tunlinkat

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tunlinkat

impl RefUnwindSafe for Tunlinkat

impl Send for Tunlinkat

impl Sync for Tunlinkat

impl Unpin for Tunlinkat

impl UnwindSafe for Tunlinkat

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Tversion

pub struct Tversion {
    pub msize: u32,
    pub version: String,
}

version – negotiate protocol version

size[4] Tversion tag[2] msize[4] version[s]
size[4] Rversion tag[2] msize[4] version[s]

version establishes the msize, which is the maximum message size inclusive of the size value that can be handled by both client and server.

It also establishes the protocol version. For 9P2000.L version must be the string 9P2000.L.

See the Plan 9 manual page for version(5).

Fields

msize: u32``version: String

Trait Implementations

impl Debug for Tversion

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Tversion

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Tversion

impl RefUnwindSafe for Tversion

impl Send for Tversion

impl Sync for Tversion

impl Unpin for Tversion

impl UnwindSafe for Tversion

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Twalk

pub struct Twalk {
    pub fid: u32,
    pub newfid: u32,
    pub wnames: Vec<String>,
}

walk – descend a directory hierarchy

size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s])
size[4] Rwalk tag[2] nwqid[2] nwqid*(wqid[13])

walk is used to descend a directory represented by fid using successive path elements provided in the wname array. If successful, newfid represents the new path.

fid can be cloned to newfid by calling walk with nwname set to zero.

See the Plan 9 manual page for walk(5).

Fields

fid: u32``newfid: u32``wnames: Vec<String>

Trait Implementations

impl Debug for Twalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Twalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Twalk

impl RefUnwindSafe for Twalk

impl Send for Twalk

impl Sync for Twalk

impl Unpin for Twalk

impl UnwindSafe for Twalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Twrite

pub struct Twrite {
    pub fid: u32,
    pub offset: u64,
    pub data: Data,
}

write – write data to a file

size[4] Twrite tag[2] fid[4] offset[8] data[count]
size[4] Rwrite tag[2] count[4]

write performs I/O on the file represented by fid.

See the Plan 9 manual page for write(5).

Fields

fid: u32``offset: u64``data: Data

Trait Implementations

impl Debug for Twrite

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Twrite

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Twrite

impl RefUnwindSafe for Twrite

impl Send for Twrite

impl Sync for Twrite

impl Unpin for Twrite

impl UnwindSafe for Twrite

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Txattrcreate

pub struct Txattrcreate {
    pub fid: u32,
    pub name: String,
    pub attr_size: u64,
    pub flags: u32,
}

xattrcreate – create an extended attribute

size[4] Txattrcreate tag[2] fid[4] name[s] attr_size[8] flags[4]
size[4] Rxattrcreate tag[2]

xattrcreate creates a new extended attribute named name of the file represented by fid.

Fields

fid: u32``name: String``attr_size: u64``flags: u32

Trait Implementations

impl Debug for Txattrcreate

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Txattrcreate

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Txattrcreate

impl RefUnwindSafe for Txattrcreate

impl Send for Txattrcreate

impl Sync for Txattrcreate

impl Unpin for Txattrcreate

impl UnwindSafe for Txattrcreate

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p::messages

Struct Txattrwalk

pub struct Txattrwalk {
    pub fid: u32,
    pub newfid: u32,
    pub name: String,
}

xattrwalk – walk extended attributes

size[4] Txattrwalk tag[2] fid[4] newfid[4] name[s]
size[4] Rxattrwalk tag[2] size[8]

xattrwalk gets a new fid pointing to the extended attribute directory of the file represented by fid.

Fields

fid: u32``newfid: u32``name: String

Trait Implementations

impl Debug for Txattrwalk

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl WireFormat for Txattrwalk

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(_reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Txattrwalk

impl RefUnwindSafe for Txattrwalk

impl Send for Txattrwalk

impl Sync for Txattrwalk

impl Unpin for Txattrwalk

impl UnwindSafe for Txattrwalk

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_9p

Module ninep_2000_l

Traits

  • Nine``P200L: 9p

jetstream_9p::ninep_2000_l

Trait NineP200L

pub trait NineP200L: Send + Sync {
    // Required methods
    fn version(
        &mut self,
        tag: u16,
        version: &Tversion,
    ) -> impl Future<Output = Result<Rversion>> + Send + Sync;
    fn auth(
        &mut self,
        tag: u16,
        auth: &Tauth,
    ) -> impl Future<Output = Result<Rauth>> + Send + Sync;
    fn flush(
        &mut self,
        tag: u16,
        flush: &Tflush,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn walk(
        &mut self,
        tag: u16,
        walk: &Twalk,
    ) -> impl Future<Output = Result<Rwalk>> + Send + Sync;
    fn read(
        &mut self,
        tag: u16,
        read: &Tread,
    ) -> impl Future<Output = Result<Rread>> + Send + Sync;
    fn write(
        &mut self,
        tag: u16,
        write: &Twrite,
    ) -> impl Future<Output = Result<Rwrite>> + Send + Sync;
    fn clunk(
        &mut self,
        tag: u16,
        clunk: &Tclunk,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn remove(
        &mut self,
        tag: u16,
        remove: &Tremove,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn attach(
        &mut self,
        tag: u16,
        attach: &Tattach,
    ) -> impl Future<Output = Result<Rattach>> + Send + Sync;
    fn statfs(
        &mut self,
        tag: u16,
        statfs: &Tstatfs,
    ) -> impl Future<Output = Result<Rstatfs>> + Send + Sync;
    fn lopen(
        &mut self,
        tag: u16,
        lopen: &Tlopen,
    ) -> impl Future<Output = Result<Rlopen>> + Send + Sync;
    fn lcreate(
        &mut self,
        tag: u16,
        lcreate: &Tlcreate,
    ) -> impl Future<Output = Result<Rlcreate>> + Send + Sync;
    fn symlink(
        &mut self,
        tag: u16,
        symlink: &Tsymlink,
    ) -> impl Future<Output = Result<Rsymlink>> + Send + Sync;
    fn mknod(
        &mut self,
        tag: u16,
        mknod: &Tmknod,
    ) -> impl Future<Output = Result<Rmknod>> + Send + Sync;
    fn rename(
        &mut self,
        tag: u16,
        rename: &Trename,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn readlink(
        &mut self,
        tag: u16,
        readlink: &Treadlink,
    ) -> impl Future<Output = Result<Rreadlink>> + Send + Sync;
    fn get_attr(
        &mut self,
        tag: u16,
        get_attr: &Tgetattr,
    ) -> impl Future<Output = Result<Rgetattr>> + Send + Sync;
    fn set_attr(
        &mut self,
        tag: u16,
        set_attr: &Tsetattr,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn xattr_walk(
        &mut self,
        tag: u16,
        xattr_walk: &Txattrwalk,
    ) -> impl Future<Output = Result<Rxattrwalk>> + Send + Sync;
    fn xattr_create(
        &mut self,
        tag: u16,
        xattr_create: &Txattrcreate,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn readdir(
        &mut self,
        tag: u16,
        readdir: &Treaddir,
    ) -> impl Future<Output = Result<Rreaddir>> + Send + Sync;
    fn fsync(
        &mut self,
        tag: u16,
        fsync: &Tfsync,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn lock(
        &mut self,
        tag: u16,
        lock: &Tlock,
    ) -> impl Future<Output = Result<Rlock>> + Send + Sync;
    fn get_lock(
        &mut self,
        tag: u16,
        get_lock: &Tgetlock,
    ) -> impl Future<Output = Result<Rgetlock>> + Send + Sync;
    fn link(
        &mut self,
        tag: u16,
        link: &Tlink,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn mkdir(
        &mut self,
        tag: u16,
        mkdir: &Tmkdir,
    ) -> impl Future<Output = Result<Rmkdir>> + Send + Sync;
    fn rename_at(
        &mut self,
        tag: u16,
        rename_at: &Trenameat,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
    fn unlink_at(
        &mut self,
        tag: u16,
        unlink_at: &Tunlinkat,
    ) -> impl Future<Output = Result<()>> + Send + Sync;
}

9p

Required Methods

fn version( &mut self, tag: u16, version: &Tversion, ) -> impl Future<Output = Result> + Send + Sync

The version message is the first message sent on a connection. It is used to negotiate the 9P protocol version and maximum message size.

fn auth( &mut self, tag: u16, auth: &Tauth, ) -> impl Future<Output = Result> + Send + Sync

The auth message is used to authenticate a user to the server. It is sent after the version message and before any other messages. The auth message is optional and may be ignored by the server.

fn flush( &mut self, tag: u16, flush: &Tflush, ) -> impl Future<Output = Result<()>> + Send + Sync

The flush message is used to flush pending I/O requests.

fn walk( &mut self, tag: u16, walk: &Twalk, ) -> impl Future<Output = Result> + Send + Sync

The walk message is used to traverse the file system hierarchy. It is sent by the client and responded to by the server.

fn read( &mut self, tag: u16, read: &Tread, ) -> impl Future<Output = Result> + Send + Sync

The read message is used to read data from a file.

fn write( &mut self, tag: u16, write: &Twrite, ) -> impl Future<Output = Result> + Send + Sync

The write message is used to write data to a file.

fn clunk( &mut self, tag: u16, clunk: &Tclunk, ) -> impl Future<Output = Result<()>> + Send + Sync

The clunk message is used to release a fid.

fn remove( &mut self, tag: u16, remove: &Tremove, ) -> impl Future<Output = Result<()>> + Send + Sync

The remove message is used to remove a file.

fn attach( &mut self, tag: u16, attach: &Tattach, ) -> impl Future<Output = Result> + Send + Sync

The attach message is used to associate a fid with a file.

fn statfs( &mut self, tag: u16, statfs: &Tstatfs, ) -> impl Future<Output = Result> + Send + Sync

The statfs message is used to retrieve file system information.

fn lopen( &mut self, tag: u16, lopen: &Tlopen, ) -> impl Future<Output = Result> + Send + Sync

The lopen message is used to open a file.

fn lcreate( &mut self, tag: u16, lcreate: &Tlcreate, ) -> impl Future<Output = Result> + Send + Sync

The lcreate message is used to create a file.

The symlink message is used to create a symbolic link.

fn mknod( &mut self, tag: u16, mknod: &Tmknod, ) -> impl Future<Output = Result> + Send + Sync

The mknod message is used to create a device file.

fn rename( &mut self, tag: u16, rename: &Trename, ) -> impl Future<Output = Result<()>> + Send + Sync

The rename message is used to rename a file.

The readlink message is used to read the target of a symbolic link.

fn get_attr( &mut self, tag: u16, get_attr: &Tgetattr, ) -> impl Future<Output = Result> + Send + Sync

The getattr message is used to retrieve file attributes.

fn set_attr( &mut self, tag: u16, set_attr: &Tsetattr, ) -> impl Future<Output = Result<()>> + Send + Sync

The setattr message is used to set file attributes.

fn xattr_walk( &mut self, tag: u16, xattr_walk: &Txattrwalk, ) -> impl Future<Output = Result> + Send + Sync

The xattrwalk message is used to traverse extended attributes.

fn xattr_create( &mut self, tag: u16, xattr_create: &Txattrcreate, ) -> impl Future<Output = Result<()>> + Send + Sync

The xattrcreate message is used to create an extended attribute.

fn readdir( &mut self, tag: u16, readdir: &Treaddir, ) -> impl Future<Output = Result> + Send + Sync

The readdir message is used to read a directory.

fn fsync( &mut self, tag: u16, fsync: &Tfsync, ) -> impl Future<Output = Result<()>> + Send + Sync

The fsync message is used to synchronize a file’s data and metadata.

fn lock( &mut self, tag: u16, lock: &Tlock, ) -> impl Future<Output = Result> + Send + Sync

The lock message is used to lock a file.

fn get_lock( &mut self, tag: u16, get_lock: &Tgetlock, ) -> impl Future<Output = Result> + Send + Sync

The getlock message is used to retrieve a file’s locks.

The link message is used to create a hard link.

fn mkdir( &mut self, tag: u16, mkdir: &Tmkdir, ) -> impl Future<Output = Result> + Send + Sync

The mkdir message is used to create a directory.

fn rename_at( &mut self, tag: u16, rename_at: &Trenameat, ) -> impl Future<Output = Result<()>> + Send + Sync

The renameat message is used to rename a file.

The unlinkat message is used to remove a file.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

Crate jetstream_client

Structs

  • Client``Codec:

jetstream_client

Struct ClientCodec

pub struct ClientCodec<P>where
    P: Protocol,{ /* private fields */ }

Trait Implementations

impl<P: Protocol> Decoder for ClientCodec

type Error = Error

The type of unrecoverable frame decoding errors. Read more

type Item = Frame<

::Response>

The type of decoded frames.

fn decode( &mut self, src: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

Attempts to decode a frame from the provided buffer of bytes. Read more

fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more

fn framed(self, io: T) -> Framed<T, Self>where T: AsyncRead + AsyncWrite, Self: Sized,

Provides a Stream and Sink interface for reading and writing to thisIo object, using Decode and Encode to read and write the raw data. Read more

impl

Default for ClientCodec

where P: Protocol,

fn default() -> Self

Returns the “default value” for a type. Read more

impl<P: Protocol> Encoder<Frame<

::Request>> for ClientCodec

type Error = Error

The type of encoding errors. Read more

fn encode( &mut self, item: Frame<P::Request>, dst: &mut BytesMut, ) -> Result<(), Self::Error>

Encodes a frame into the buffer provided. Read more

Auto Trait Implementations

impl

Freeze for ClientCodec

impl

RefUnwindSafe for ClientCodec

where P: RefUnwindSafe,

impl

Send for ClientCodec

impl

Sync for ClientCodec

impl

Unpin for ClientCodec

where P: Unpin,

impl

UnwindSafe for ClientCodec

where P: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

Crate jetstream_macros

JetStream Derive

This crate provides macros for JetStream.

service

The service macro is used to define a JetStream service.

JetStreamWireFormat

The JetStreamWireFormat macro is used to derive the WireFormat trait for a struct.

Attribute Macros

  • service: Service attribute macro for creating RPC services

Derive Macros

  • JetStream``Wire``Format: Derives wire format encoding for structs

jetstream_macros

Attribute Macro service

#[service]

Service attribute macro for creating RPC services

jetstream_macros

Derive Macro JetStreamWireFormat

#[derive(JetStreamWireFormat)]

Derives wire format encoding for structs

Crate jetstream_rpc

JetStream Rpc

Defines Rpc primitives for JetStream. Of note is the Protocol trait which is meant to be used with the service attribute macro.

Structs

Enums

Traits

  • Client``Transport:
  • Decoder: Decoding of frames via buffers.
  • Encoder: Trait of helper objects to write out messages as bytes, for use withFramedWrite.
  • Framer:
  • FromContext:
  • Handler:
  • Message: A trait representing a message that can be encoded and decoded.
  • Protocol: Defines the request and response types for the JetStream protocol.
  • Service``Transport:

jetstream_rpc

Enum Error

pub enum Error {
    Io(Error),
    Generic(Box<dyn Error + Send + Sync>),
    Custom(String),
    InvalidResponse,
}

Variants

Io(Error)

Generic(Box<dyn Error + Send + Sync>)

Custom(String)

InvalidResponse

Trait Implementations

impl Debug for Error

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl Display for Error

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl Error for Error

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more1.0.0 ·

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string() Read more1.0.0 ·

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type-based access to context intended for error reports. Read more

impl From<Box<dyn Error + Send + Sync>> for Error

fn from(source: Box<dyn Error + Send + Sync>) -> Self

Converts to this type from the input type.

impl From for Error

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations

impl Freeze for Error

impl !RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl !UnwindSafe for Error

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl ToString for Twhere T: Display + ?Sized,

default fn to_string(&self) -> String

Converts the given value to a String. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_rpc

Struct Context

pub struct Context<T: WireFormat> {
    pub tag: Tag,
    pub msg: T,
}

Fields

tag: Tag``msg: T

Auto Trait Implementations

impl Freeze for Contextwhere T: Freeze,

impl RefUnwindSafe for Contextwhere T: RefUnwindSafe,

impl Send for Context

impl Sync for Contextwhere T: Sync,

impl Unpin for Contextwhere T: Unpin,

impl UnwindSafe for Contextwhere T: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_rpc

Struct Frame

pub struct Frame<T: Framer> {
    pub tag: u16,
    pub msg: T,
}

Fields

tag: u16``msg: T

Trait Implementations

impl<T: Framer> From<(u16, T)> for Frame

fn from((tag, msg): (u16, T)) -> Self

Converts to this type from the input type.

impl<T: Framer> WireFormat for Frame

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R) -> Result

Decodes Self from reader.

Auto Trait Implementations

impl Freeze for Framewhere T: Freeze,

impl RefUnwindSafe for Framewhere T: RefUnwindSafe,

impl Send for Frame

impl Sync for Frame

impl Unpin for Framewhere T: Unpin,

impl UnwindSafe for Framewhere T: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<(), Error>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async( reader: R, ) -> impl Future<Output = Result<Self, Error>> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl FromContext for Twhere T: WireFormat,

fn from_context(ctx: Context) -> T

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_rpc

Struct Framed

pub struct Framed<T, U> { /* private fields */ }

A unified Stream and Sink interface to an underlying I/O object, using the Encoder and Decoder traits to encode and decode frames.

You can create a Framed instance by using the Decoder::framed adapter, or by using the new function seen below.

Cancellation safety

  • futures_util::sink::SinkExt::send: if send is used as the event in atokio::select! statement and some other branch completes first, then it is guaranteed that the message was not sent, but the message itself is lost.
  • tokio_stream::StreamExt::next: This method is cancel safe. The returned future only holds onto a reference to the underlying stream, so dropping it will never lose a value.

Implementations

impl<T, U> Framed<T, U>where T: AsyncRead + AsyncWrite,

pub fn new(inner: T, codec: U) -> Framed<T, U>

Provides a Stream and Sink interface for reading and writing to this I/O object, using Decoder and Encoder to read and write the raw data.

Raw I/O objects work with byte sequences, but higher-level code usually wants to batch these into meaningful chunks, called “frames”. This method layers framing on top of an I/O object, by using the codec traits to handle encoding and decoding of messages frames. Note that the incoming and outgoing frame types may be distinct.

This function returns a single object that is both Stream and Sink; grouping this into a single object is often useful for layering things like gzip or TLS, which require both read and write access to the underlying object.

If you want to work more directly with the streams and sink, consider calling split on the Framed returned by this method, which will break them into separate objects, allowing them to interact more easily.

Note that, for some byte sources, the stream can be resumed after an EOF by reading from it, even after it has returned None. Repeated attempts to do so, without new data available, continue to return None without creating more (closing) frames.

pub fn with_capacity(inner: T, codec: U, capacity: usize) -> Framed<T, U>

Provides a Stream and Sink interface for reading and writing to this I/O object, using Decoder and Encoder to read and write the raw data, with a specific read buffer initial capacity.

Raw I/O objects work with byte sequences, but higher-level code usually wants to batch these into meaningful chunks, called “frames”. This method layers framing on top of an I/O object, by using the codec traits to handle encoding and decoding of messages frames. Note that the incoming and outgoing frame types may be distinct.

This function returns a single object that is both Stream and Sink; grouping this into a single object is often useful for layering things like gzip or TLS, which require both read and write access to the underlying object.

If you want to work more directly with the streams and sink, consider calling split on the Framed returned by this method, which will break them into separate objects, allowing them to interact more easily.

impl<T, U> Framed<T, U>

pub fn from_parts(parts: FramedParts<T, U>) -> Framed<T, U>

Provides a Stream and Sink interface for reading and writing to this I/O object, using Decoder and Encoder to read and write the raw data.

Raw I/O objects work with byte sequences, but higher-level code usually wants to batch these into meaningful chunks, called “frames”. This method layers framing on top of an I/O object, by using the Codectraits to handle encoding and decoding of messages frames. Note that the incoming and outgoing frame types may be distinct.

This function returns a single object that is both Stream and Sink; grouping this into a single object is often useful for layering things like gzip or TLS, which require both read and write access to the underlying object.

This objects takes a stream and a readbuffer and a writebuffer. These field can be obtained from an existing Framed with the into_parts method.

If you want to work more directly with the streams and sink, consider calling split on the Framed returned by this method, which will break them into separate objects, allowing them to interact more easily.

pub fn get_ref(&self) -> &T

Returns a reference to the underlying I/O stream wrapped by Framed.

Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

pub fn get_mut(&mut self) -> &mut T

Returns a mutable reference to the underlying I/O stream wrapped by Framed.

Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

pub fn get_pin_mut(self: Pin<&mut Framed<T, U>>) -> Pin<&mut T>

Returns a pinned mutable reference to the underlying I/O stream wrapped by Framed.

Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

pub fn codec(&self) -> &U

Returns a reference to the underlying codec wrapped by Framed.

Note that care should be taken to not tamper with the underlying codec as it may corrupt the stream of frames otherwise being worked with.

pub fn codec_mut(&mut self) -> &mut U

Returns a mutable reference to the underlying codec wrapped by Framed.

Note that care should be taken to not tamper with the underlying codec as it may corrupt the stream of frames otherwise being worked with.

pub fn map_codec<C, F>(self, map: F) -> Framed<T, C>where F: FnOnce(U) -> C,

Maps the codec U to C, preserving the read and write buffers wrapped by Framed.

Note that care should be taken to not tamper with the underlying codec as it may corrupt the stream of frames otherwise being worked with.

pub fn codec_pin_mut(self: Pin<&mut Framed<T, U>>) -> &mut U

Returns a mutable reference to the underlying codec wrapped by Framed.

Note that care should be taken to not tamper with the underlying codec as it may corrupt the stream of frames otherwise being worked with.

pub fn read_buffer(&self) -> &BytesMut

Returns a reference to the read buffer.

pub fn read_buffer_mut(&mut self) -> &mut BytesMut

Returns a mutable reference to the read buffer.

pub fn write_buffer(&self) -> &BytesMut

Returns a reference to the write buffer.

pub fn write_buffer_mut(&mut self) -> &mut BytesMut

Returns a mutable reference to the write buffer.

pub fn backpressure_boundary(&self) -> usize

Returns backpressure boundary

pub fn set_backpressure_boundary(&mut self, boundary: usize)

Updates backpressure boundary

pub fn into_inner(self) -> T

Consumes the Framed, returning its underlying I/O stream.

Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

pub fn into_parts(self) -> FramedParts<T, U>

Consumes the Framed, returning its underlying I/O stream, the buffer with unprocessed data, and the codec.

Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

Trait Implementations

impl<T, U> Debug for Framed<T, U>where T: Debug, U: Debug,

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl<T, I, U> Sink for Framed<T, U>where T: AsyncWrite, U: Encoder, <U as Encoder>::Error: From,

type Error = <U as Encoder>::Error

The type of value produced by the sink when an error occurs.

fn poll_ready( self: Pin<&mut Framed<T, U>>, cx: &mut Context<'_>, ) -> Poll<Result<(), <Framed<T, U> as Sink>::Error>>

Attempts to prepare the Sink to receive a value. Read more

fn start_send( self: Pin<&mut Framed<T, U>>, item: I, ) -> Result<(), <Framed<T, U> as Sink>::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call topoll_ready which returned Poll::Ready(Ok(())). Read more

fn poll_flush( self: Pin<&mut Framed<T, U>>, cx: &mut Context<'_>, ) -> Poll<Result<(), <Framed<T, U> as Sink>::Error>>

Flush any remaining output from this sink. Read more

fn poll_close( self: Pin<&mut Framed<T, U>>, cx: &mut Context<'_>, ) -> Poll<Result<(), <Framed<T, U> as Sink>::Error>>

Flush any remaining output and close this sink, if necessary. Read more

impl<T, U> Stream for Framed<T, U>where T: AsyncRead, U: Decoder,

type Item = Result<::Item, ::Error>

Values yielded by the stream.

fn poll_next( self: Pin<&mut Framed<T, U>>, cx: &mut Context<'_>, ) -> Poll<Option<<Framed<T, U> as Stream>::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returningNone if the stream is exhausted. Read more

fn size_hint(&self) -> (usize, Option)

Returns the bounds on the remaining length of the stream. Read more

impl<'__pin, T, U> Unpin for Framed<T, U>where <PinnedFieldsOfHelperStruct<__Origin<'__pin, T, U>> as PinnedFieldsOfHelperTrait>::Actual: Unpin,

Auto Trait Implementations

impl<T, U> Freeze for Framed<T, U>where T: Freeze, U: Freeze,

impl<T, U> RefUnwindSafe for Framed<T, U>where T: RefUnwindSafe, U: RefUnwindSafe,

impl<T, U> Send for Framed<T, U>where T: Send, U: Send,

impl<T, U> Sync for Framed<T, U>where T: Sync, U: Sync,

impl<T, U> UnwindSafe for Framed<T, U>where T: UnwindSafe, U: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, Item> SinkExt for Twhere T: Sink + ?Sized,

fn with<U, Fut, F, E>(self, f: F) -> With<Self, Item, U, Fut, F>where F: FnMut(U) -> Fut, Fut: Future<Output = Result<Item, E>>, E: FromSelf::Error, Self: Sized,

Composes a function in front of the sink. Read more

fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, Item, U, St, F>where F: FnMut(U) -> St, St: Stream<Item = Result<Item, Self::Error>>, Self: Sized,

Composes a function in front of the sink. Read more

fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>where F: FnOnce(Self::Error) -> E, Self: Sized,

Transforms the error returned by the sink.

fn sink_err_into(self) -> SinkErrInto<Self, Item, E>where Self: Sized, Self::Error: Into,

Map this sink’s error to a different error type using the Into trait. Read more

fn buffer(self, capacity: usize) -> Buffer<Self, Item>where Self: Sized,

Adds a fixed-size buffer to the current sink. Read more

fn close(&mut self) -> Close<'_, Self, Item>where Self: Unpin,

Close the sink.

fn fanout(self, other: Si) -> Fanout<Self, Si>where Self: Sized, Item: Clone, Si: Sink<Item, Error = Self::Error>,

Fanout items to multiple sinks. Read more

fn flush(&mut self) -> Flush<'_, Self, Item>where Self: Unpin,

Flush the sink, processing all pending items. Read more

fn send(&mut self, item: Item) -> Send<'_, Self, Item>where Self: Unpin,

A future that completes after the given item has been fully processed into the sink, including flushing. Read more

fn feed(&mut self, item: Item) -> Feed<'_, Self, Item>where Self: Unpin,

A future that completes after the given item has been received by the sink. Read more

fn send_all<'a, St>(&'a mut self, stream: &'a mut St) -> SendAll<'a, Self, St>where St: TryStream<Ok = Item, Error = Self::Error> + Stream + Unpin + ?Sized, Self: Unpin,

A future that completes after the given stream has been fully processed into the sink, including flushing. Read more

fn left_sink(self) -> Either<Self, Si2>where Si2: Sink<Item, Error = Self::Error>, Self: Sized,

Wrap this sink in an Either sink, making it the left-hand variant of that Either. Read more

fn right_sink(self) -> Either<Si1, Self>where Si1: Sink<Item, Error = Self::Error>, Self: Sized,

Wrap this stream in an Either stream, making it the right-hand variant of that Either. Read more

fn poll_ready_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>where Self: Unpin,

A convenience method for calling Sink::poll_ready on Unpinsink types.

fn start_send_unpin(&mut self, item: Item) -> Result<(), Self::Error>where Self: Unpin,

A convenience method for calling Sink::start_send on Unpinsink types.

fn poll_flush_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>where Self: Unpin,

A convenience method for calling Sink::poll_flush on Unpinsink types.

fn poll_close_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>where Self: Unpin,

A convenience method for calling Sink::poll_close on Unpinsink types.

impl StreamExt for Twhere T: Stream + ?Sized,

fn next(&mut self) -> Next<'_, Self>where Self: Unpin,

Creates a future that resolves to the next item in the stream. Read more

fn into_future(self) -> StreamFuturewhere Self: Sized + Unpin,

Converts this stream into a future of (next_item, tail_of_stream). If the stream terminates, then the next item is None. Read more

fn map<T, F>(self, f: F) -> Map<Self, F>where F: FnMut(Self::Item) -> T, Self: Sized,

Maps this stream’s items to a different type, returning a new stream of the resulting type. Read more

fn enumerate(self) -> Enumeratewhere Self: Sized,

Creates a stream which gives the current iteration count as well as the next value. Read more

fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,

Filters the values produced by this stream according to the provided asynchronous predicate. Read more

fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = Option>, Self: Sized,

Filters the values produced by this stream while simultaneously mapping them to a different type according to the provided asynchronous closure. Read more

fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future, Self: Sized,

Computes from this stream’s items new items of a different type using an asynchronous closure. Read more

fn collect(self) -> Collect<Self, C>where C: Default + ExtendSelf::Item, Self: Sized,

Transforms a stream into a collection, returning a future representing the result of that computation. Read more

fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB>where FromA: Default + Extend, FromB: Default + Extend, Self: Sized + Stream<Item = (A, B)>,

Converts a stream of pairs into a future, which resolves to pair of containers. Read more

fn concat(self) -> Concatwhere Self: Sized, Self::Item: Extend<<Self::Item as IntoIterator>::Item> + IntoIterator + Default,

Concatenate all items of a stream into a single extendable destination, returning a future representing the end result. Read more

fn count(self) -> Countwhere Self: Sized,

Drives the stream to completion, counting the number of items. Read more

fn cycle(self) -> Cyclewhere Self: Sized + Clone,

Repeats a stream endlessly. Read more

fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>where F: FnMut(T, Self::Item) -> Fut, Fut: Future<Output = T>, Self: Sized,

Execute an accumulating asynchronous computation over a stream, collecting all the values into one final result. Read more

fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,

Execute predicate over asynchronous stream, and return true if any element in stream satisfied a predicate. Read more

fn all<Fut, F>(self, f: F) -> All<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,

Execute predicate over asynchronous stream, and return true if all element in stream satisfied a predicate. Read more

fn flatten(self) -> Flattenwhere Self::Item: Stream, Self: Sized,

Flattens a stream of streams into just one continuous stream. Read more

fn flatten_unordered( self, limit: impl Into<Option>, ) -> FlattenUnorderedWithFlowController<Self, ()>where Self::Item: Stream + Unpin, Self: Sized,

Flattens a stream of streams into just one continuous stream. Polls inner streams produced by the base stream concurrently. Read more

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where F: FnMut(Self::Item) -> U, U: Stream, Self: Sized,

Maps a stream like StreamExt::map but flattens nested Streams. Read more

fn flat_map_unordered<U, F>( self, limit: impl Into<Option>, f: F, ) -> FlatMapUnordered<Self, U, F>where U: Stream + Unpin, F: FnMut(Self::Item) -> U, Self: Sized,

Maps a stream like StreamExt::map but flattens nested Streams and polls them concurrently, yielding items in any order, as they made available. Read more

fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>where F: FnMut(&mut S, Self::Item) -> Fut, Fut: Future<Output = Option>, Self: Sized,

Combinator similar to StreamExt::fold that holds internal state and produces a new stream. Read more

fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,

Skip elements on this stream while the provided asynchronous predicate resolves to true. Read more

fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>where F: FnMut(&Self::Item) -> Fut, Fut: Future<Output = bool>, Self: Sized,

Take elements from this stream while the provided asynchronous predicate resolves to true. Read more

fn take_until(self, fut: Fut) -> TakeUntil<Self, Fut>where Fut: Future, Self: Sized,

Take elements from this stream until the provided future resolves. Read more

fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = ()>, Self: Sized,

Runs this stream to completion, executing the provided asynchronous closure for each element on the stream. Read more

fn for_each_concurrent<Fut, F>( self, limit: impl Into<Option>, f: F, ) -> ForEachConcurrent<Self, Fut, F>where F: FnMut(Self::Item) -> Fut, Fut: Future<Output = ()>, Self: Sized,

Runs this stream to completion, executing the provided asynchronous closure for each element on the stream concurrently as elements become available. Read more

fn take(self, n: usize) -> Takewhere Self: Sized,

Creates a new stream of at most n items of the underlying stream. Read more

fn skip(self, n: usize) -> Skipwhere Self: Sized,

Creates a new stream which skips n items of the underlying stream. Read more

fn fuse(self) -> Fusewhere Self: Sized,

Fuse a stream such that poll_next will never again be called once it has finished. This method can be used to turn any Stream into a FusedStream. Read more

fn by_ref(&mut self) -> &mut Self

Borrows a stream, rather than consuming it. Read more

fn catch_unwind(self) -> CatchUnwindwhere Self: Sized + UnwindSafe,

Catches unwinding panics while polling the stream. Read more

fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>where Self: Sized + Send + 'a,

Wrap the stream in a Box, pinning it. Read more

fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where Self: Sized + 'a,

Wrap the stream in a Box, pinning it. Read more

fn buffered(self, n: usize) -> Bufferedwhere Self::Item: Future, Self: Sized,

An adaptor for creating a buffered list of pending futures. Read more

fn buffer_unordered(self, n: usize) -> BufferUnorderedwhere Self::Item: Future, Self: Sized,

An adaptor for creating a buffered list of pending futures (unordered). Read more

fn zip(self, other: St) -> Zip<Self, St>where St: Stream, Self: Sized,

An adapter for zipping two streams together. Read more

fn chain(self, other: St) -> Chain<Self, St>where St: Stream<Item = Self::Item>, Self: Sized,

Adapter for chaining two streams. Read more

fn peekable(self) -> Peekablewhere Self: Sized,

Creates a new stream which exposes a peek method. Read more

fn chunks(self, capacity: usize) -> Chunkswhere Self: Sized,

An adaptor for chunking up items of the stream inside a vector. Read more

fn ready_chunks(self, capacity: usize) -> ReadyChunkswhere Self: Sized,

An adaptor for chunking up ready items of the stream inside a vector. Read more

fn forward(self, sink: S) -> Forward<Self, S>where S: Sink<Self::Ok, Error = Self::Error>, Self: Sized + TryStream,

A future that completes after the given stream has been fully processed into the sink and the sink has been flushed and closed. Read more

fn split(self) -> (SplitSink<Self, Item>, SplitStream)where Self: Sized + Sink,

Splits this Stream + Sink object into separate Sink and Streamobjects. Read more

fn inspect(self, f: F) -> Inspect<Self, F>where F: FnMut(&Self::Item), Self: Sized,

Do something with each item of this stream, afterwards passing it on. Read more

fn left_stream(self) -> Either<Self, B>where B: Stream<Item = Self::Item>, Self: Sized,

Wrap this stream in an Either stream, making it the left-hand variant of that Either. Read more

fn right_stream(self) -> Either<B, Self>where B: Stream<Item = Self::Item>, Self: Sized,

Wrap this stream in an Either stream, making it the right-hand variant of that Either. Read more

fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<OptionSelf::Item>where Self: Unpin,

A convenience method for calling Stream::poll_next on Unpinstream types.

fn select_next_some(&mut self) -> SelectNextSome<'_, Self>where Self: Unpin + FusedStream,

Returns a Future that resolves when the next item in this stream is ready. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

impl<S, T, E> TryStream for Swhere S: Stream<Item = Result<T, E>> + ?Sized,

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

fn try_poll_next( self: Pin<&mut S>, cx: &mut Context<'_>, ) -> Poll<Option<Result<::Ok, ::Error>>>

Poll this TryStream as if it were a Stream. Read more

impl TryStreamExt for Swhere S: TryStream + ?Sized,

fn err_into(self) -> ErrInto<Self, E>where Self: Sized, Self::Error: Into,

Wraps the current stream in a new stream which converts the error type into the one provided. Read more

fn map_ok<T, F>(self, f: F) -> MapOk<Self, F>where Self: Sized, F: FnMut(Self::Ok) -> T,

Wraps the current stream in a new stream which maps the success value using the provided closure. Read more

fn map_err<E, F>(self, f: F) -> MapErr<Self, F>where Self: Sized, F: FnMut(Self::Error) -> E,

Wraps the current stream in a new stream which maps the error value using the provided closure. Read more

fn and_then<Fut, F>(self, f: F) -> AndThen<Self, Fut, F>where F: FnMut(Self::Ok) -> Fut, Fut: TryFuture<Error = Self::Error>, Self: Sized,

Chain on a computation for when a value is ready, passing the successful results to the provided closure f. Read more

fn or_else<Fut, F>(self, f: F) -> OrElse<Self, Fut, F>where F: FnMut(Self::Error) -> Fut, Fut: TryFuture<Ok = Self::Ok>, Self: Sized,

Chain on a computation for when an error happens, passing the erroneous result to the provided closure f. Read more

fn inspect_ok(self, f: F) -> InspectOk<Self, F>where F: FnMut(&Self::Ok), Self: Sized,

Do something with the success value of this stream, afterwards passing it on. Read more

fn inspect_err(self, f: F) -> InspectErr<Self, F>where F: FnMut(&Self::Error), Self: Sized,

Do something with the error value of this stream, afterwards passing it on. Read more

fn into_stream(self) -> IntoStreamwhere Self: Sized,

Wraps a TryStream into a type that implementsStream Read more

fn try_next(&mut self) -> TryNext<'_, Self>where Self: Unpin,

Creates a future that attempts to resolve the next item in the stream. If an error is encountered before the next item, the error is returned instead. Read more

fn try_for_each<Fut, F>(self, f: F) -> TryForEach<Self, Fut, F>where F: FnMut(Self::Ok) -> Fut, Fut: TryFuture<Ok = (), Error = Self::Error>, Self: Sized,

Attempts to run this stream to completion, executing the provided asynchronous closure for each element on the stream. Read more

fn try_skip_while<Fut, F>(self, f: F) -> TrySkipWhile<Self, Fut, F>where F: FnMut(&Self::Ok) -> Fut, Fut: TryFuture<Ok = bool, Error = Self::Error>, Self: Sized,

Skip elements on this stream while the provided asynchronous predicate resolves to true. Read more

fn try_take_while<Fut, F>(self, f: F) -> TryTakeWhile<Self, Fut, F>where F: FnMut(&Self::Ok) -> Fut, Fut: TryFuture<Ok = bool, Error = Self::Error>, Self: Sized,

Take elements on this stream while the provided asynchronous predicate resolves to true. Read more

fn try_for_each_concurrent<Fut, F>( self, limit: impl Into<Option>, f: F, ) -> TryForEachConcurrent<Self, Fut, F>where F: FnMut(Self::Ok) -> Fut, Fut: Future<Output = Result<(), Self::Error>>, Self: Sized,

Attempts to run this stream to completion, executing the provided asynchronous closure for each element on the stream concurrently as elements become available, exiting as soon as an error occurs. Read more

fn try_collect(self) -> TryCollect<Self, C>where C: Default + ExtendSelf::Ok, Self: Sized,

Attempt to transform a stream into a collection, returning a future representing the result of that computation. Read more

fn try_chunks(self, capacity: usize) -> TryChunkswhere Self: Sized,

An adaptor for chunking up successful items of the stream inside a vector. Read more

fn try_ready_chunks(self, capacity: usize) -> TryReadyChunkswhere Self: Sized,

An adaptor for chunking up successful, ready items of the stream inside a vector. Read more

fn try_filter<Fut, F>(self, f: F) -> TryFilter<Self, Fut, F>where Fut: Future<Output = bool>, F: FnMut(&Self::Ok) -> Fut, Self: Sized,

Attempt to filter the values produced by this stream according to the provided asynchronous closure. Read more

fn try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>where Fut: TryFuture<Ok = Option, Error = Self::Error>, F: FnMut(Self::Ok) -> Fut, Self: Sized,

Attempt to filter the values produced by this stream while simultaneously mapping them to a different type according to the provided asynchronous closure. Read more

fn try_flatten_unordered( self, limit: impl Into<Option>, ) -> TryFlattenUnorderedwhere Self::Ok: TryStream + Unpin, <Self::Ok as TryStream>::Error: FromSelf::Error, Self: Sized,

Flattens a stream of streams into just one continuous stream. Produced streams will be polled concurrently and any errors will be passed through without looking at them. If the underlying base stream returns an error, it will be immediately propagated. Read more

fn try_flatten(self) -> TryFlattenwhere Self::Ok: TryStream, <Self::Ok as TryStream>::Error: FromSelf::Error, Self: Sized,

Flattens a stream of streams into just one continuous stream. Read more

fn try_fold<T, Fut, F>(self, init: T, f: F) -> TryFold<Self, Fut, T, F>where F: FnMut(T, Self::Ok) -> Fut, Fut: TryFuture<Ok = T, Error = Self::Error>, Self: Sized,

Attempt to execute an accumulating asynchronous computation over a stream, collecting all the values into one final result. Read more

fn try_concat(self) -> TryConcatwhere Self: Sized, Self::Ok: Extend<<Self::Ok as IntoIterator>::Item> + IntoIterator + Default,

Attempt to concatenate all items of a stream into a single extendable destination, returning a future representing the end result. Read more

fn try_buffer_unordered(self, n: usize) -> TryBufferUnorderedwhere Self::Ok: TryFuture<Error = Self::Error>, Self: Sized,

Attempt to execute several futures from a stream concurrently (unordered). Read more

fn try_buffered(self, n: usize) -> TryBufferedwhere Self::Ok: TryFuture<Error = Self::Error>, Self: Sized,

Attempt to execute several futures from a stream concurrently. Read more

fn try_poll_next_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<Self::Ok, Self::Error>>>where Self: Unpin,

A convenience method for calling TryStream::try_poll_next on Unpinstream types.

fn into_async_read(self) -> IntoAsyncReadwhere Self: Sized + TryStreamExt<Error = Error>, Self::Ok: AsRef<[u8]>,

Adapter that converts this stream into an AsyncBufRead. Read more

fn try_all<Fut, F>(self, f: F) -> TryAll<Self, Fut, F>where Self: Sized, F: FnMut(Self::Ok) -> Fut, Fut: Future<Output = bool>,

Attempt to execute a predicate over an asynchronous stream and evaluate if all items satisfy the predicate. Exits early if an Err is encountered or if an Ok item is found that does not satisfy the predicate. Read more

fn try_any<Fut, F>(self, f: F) -> TryAny<Self, Fut, F>where Self: Sized, F: FnMut(Self::Ok) -> Fut, Fut: Future<Output = bool>,

Attempt to execute a predicate over an asynchronous stream and evaluate if any items satisfy the predicate. Exits early if an Err is encountered or if an Ok item is found that satisfies the predicate. Read more

impl<P, T> ClientTransport

for Twhere P: Protocol, T: Sink<Frame<

::Request>, Error = Error> + Stream<Item = Result<Frame<

::Response>, Error>> + Send + Sync + Unpin,

impl<P, T> ServiceTransport

for Twhere P: Protocol, T: Sink<Frame<

::Response>, Error =

::Error> + Stream<Item = Result<Frame<

::Request>,

::Error>> + Send + Sync + Unpin,

jetstream_rpc

Struct Tag

pub struct Tag(/* private fields */);

Trait Implementations

impl From for Tag

fn from(tag: u16) -> Self

Converts to this type from the input type.

impl<T: WireFormat> FromContext for Tag

fn from_context(ctx: Context) -> Self

Auto Trait Implementations

impl Freeze for Tag

impl RefUnwindSafe for Tag

impl Send for Tag

impl Sync for Tag

impl Unpin for Tag

impl UnwindSafe for Tag

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_rpc

Trait ClientTransport

pub trait ClientTransport<P: Protocol>:
    Sink<Frame<P::Request>, Error = Error>
    + Stream<Item = Result<Frame<P::Response>, Error>>
    + Send
    + Sync
    + Unpin { }

Implementors

impl<P: Protocol, T> ClientTransport

for Twhere Self: Sized, T: Sink<Frame<P::Request>, Error = Error> + Stream<Item = Result<Frame<P::Response>, Error>> + Send + Sync + Unpin,

jetstream_rpc

Trait Decoder

pub trait Decoder {
    type Item;
    type Error: From<Error>;

    // Required method
    fn decode(
        &mut self,
        src: &mut BytesMut,
    ) -> Result<Option<Self::Item>, Self::Error>;

    // Provided methods
    fn decode_eof(
        &mut self,
        buf: &mut BytesMut,
    ) -> Result<Option<Self::Item>, Self::Error> { ... }
    fn framed<T>(self, io: T) -> Framed<T, Self>
       where T: AsyncRead + AsyncWrite,
             Self: Sized { ... }
}

Decoding of frames via buffers.

This trait is used when constructing an instance of Framed or FramedRead. An implementation of Decoder takes a byte stream that has already been buffered in src and decodes the data into a stream of Self::Item frames.

Implementations are able to track state on self, which enables implementing stateful streaming parsers. In many cases, though, this type will simply be a unit struct (e.g. struct HttpDecoder).

For some underlying data-sources, namely files and FIFOs, it’s possible to temporarily read 0 bytes by reaching EOF.

In these cases decode_eof will be called until it signals fulfillment of all closing frames by returning Ok(None). After that, repeated attempts to read from the Framed or FramedReadwill not invoke decode or decode_eof again, until data can be read during a retry.

It is up to the Decoder to keep track of a restart after an EOF, and to decide how to handle such an event by, for example, allowing frames to cross EOF boundaries, re-emitting opening frames, or resetting the entire internal state.

Required Associated Types

type Item

The type of decoded frames.

type Error: From

The type of unrecoverable frame decoding errors.

If an individual message is ill-formed but can be ignored without interfering with the processing of future messages, it may be more useful to report the failure as an Item.

From<io::Error> is required in the interest of making Error suitable for returning directly from a FramedRead, and to enable the default implementation of decode_eof to yield an io::Error when the decoder fails to consume all available data.

Note that implementors of this trait can simply indicate type Error = io::Error to use I/O errors as this type.

Required Methods

fn decode( &mut self, src: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

Attempts to decode a frame from the provided buffer of bytes.

This method is called by FramedRead whenever bytes are ready to be parsed. The provided buffer of bytes is what’s been read so far, and this instance of Decode can determine whether an entire frame is in the buffer and is ready to be returned.

If an entire frame is available, then this instance will remove those bytes from the buffer provided and return them as a decoded frame. Note that removing bytes from the provided buffer doesn’t always necessarily copy the bytes, so this should be an efficient operation in most circumstances.

If the bytes look valid, but a frame isn’t fully available yet, then Ok(None) is returned. This indicates to the Framed instance that it needs to read some more bytes before calling this method again.

Note that the bytes provided may be empty. If a previous call to decode consumed all the bytes in the buffer then decode will be called again until it returns Ok(None), indicating that more bytes need to be read.

Finally, if the bytes in the buffer are malformed then an error is returned indicating why. This informs Framed that the stream is now corrupt and should be terminated.

Buffer management

Before returning from the function, implementations should ensure that the buffer has appropriate capacity in anticipation of future calls to decode. Failing to do so leads to inefficiency.

For example, if frames have a fixed length, or if the length of the current frame is known from a header, a possible buffer management strategy is:

impl Decoder for MyCodec {
    // ...

    fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
        // ...

        // Reserve enough to complete decoding of the current frame.
        let current_frame_len: usize = 1000; // Example.
        // And to start decoding the next frame.
        let next_frame_header_len: usize = 10; // Example.
        src.reserve(current_frame_len + next_frame_header_len);

        return Ok(None);
    }
}

An optimal buffer management strategy minimizes reallocations and over-allocations.

Provided Methods

fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

A default method available to be called when there are no more bytes available to be read from the underlying I/O.

This method defaults to calling decode and returns an error if Ok(None) is returned while there is unconsumed data in buf. Typically this doesn’t need to be implemented unless the framing protocol differs near the end of the stream, or if you need to construct frames across eof boundaries on sources that can be resumed.

Note that the buf argument may be empty. If a previous call to decode_eof consumed all the bytes in the buffer, decode_eof will be called again until it returns None, indicating that there are no more frames to yield. This behavior enables returning finalization frames that may not be based on inbound data.

Once None has been returned, decode_eof won’t be called again until an attempt to resume the stream has been made, where the underlying stream actually returned more data.

fn framed(self, io: T) -> Framed<T, Self>where T: AsyncRead + AsyncWrite, Self: Sized,

Provides a Stream and Sink interface for reading and writing to this Io object, using Decode and Encode to read and write the raw data.

Raw I/O objects work with byte sequences, but higher-level code usually wants to batch these into meaningful chunks, called “frames”. This method layers framing on top of an I/O object, by using the Codectraits to handle encoding and decoding of messages frames. Note that the incoming and outgoing frame types may be distinct.

This function returns a single object that is both Stream and Sink; grouping this into a single object is often useful for layering things like gzip or TLS, which require both read and write access to the underlying object.

If you want to work more directly with the streams and sink, consider calling split on the Framed returned by this method, which will break them into separate objects, allowing them to interact more easily.

Implementors

impl Decoder for AnyDelimiterCodec

type Item = Bytes

type Error = AnyDelimiterCodecError

impl Decoder for BytesCodec

type Item = BytesMut

type Error = Error

impl Decoder for LengthDelimitedCodec

type Item = BytesMut

type Error = Error

impl Decoder for LinesCodec

type Item = String

type Error = LinesCodecError

jetstream_rpc

Trait Encoder

pub trait Encoder<Item> {
    type Error: From<Error>;

    // Required method
    fn encode(
        &mut self,
        item: Item,
        dst: &mut BytesMut,
    ) -> Result<(), Self::Error>;
}

Trait of helper objects to write out messages as bytes, for use with FramedWrite.

Required Associated Types

type Error: From

The type of encoding errors.

FramedWrite requires Encoders errors to implement From<io::Error>in the interest of letting it return Errors directly.

Required Methods

fn encode(&mut self, item: Item, dst: &mut BytesMut) -> Result<(), Self::Error>

Encodes a frame into the buffer provided.

This method will encode item into the byte buffer provided by dst. The dst provided is an internal buffer of the FramedWrite instance and will be written out when possible.

Implementors

impl Encoder for BytesCodec

type Error = Error

impl Encoder for LengthDelimitedCodec

type Error = Error

impl Encoder for BytesCodec

type Error = Error

impl Encoder for AnyDelimiterCodecwhere T: AsRef,

type Error = AnyDelimiterCodecError

impl Encoder for LinesCodecwhere T: AsRef,

type Error = LinesCodecError

jetstream_rpc

Trait Framer

pub trait Framer:
    Sized
    + Send
    + Sync {
    // Required methods
    fn message_type(&self) -> u8;
    fn byte_size(&self) -> u32;
    fn encode<W: Write>(&self, writer: &mut W) -> Result<()>;
    fn decode<R: Read>(reader: &mut R, ty: u8) -> Result<Self>;
}

Required Methods

fn message_type(&self) -> u8

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R, ty: u8) -> Result

Decodes Self from reader.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream_rpc

Trait FromContext

pub trait FromContext<T: WireFormat> {
    // Required method
    fn from_context(ctx: Context<T>) -> Self;
}

Required Methods

fn from_context(ctx: Context) -> Self

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

impl<T: WireFormat> FromContext for Tag

impl<T: WireFormat> FromContext for T

jetstream_rpc

Trait Handler

pub trait Handler<T: WireFormat> {
    // Required method
    fn call(self, context: Context<T>);
}

Required Methods

fn call(self, context: Context)

Implementors

jetstream_rpc

Trait Message

pub trait Message:
    WireFormat
    + Send
    + Sync { }

A trait representing a message that can be encoded and decoded.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream_rpc

Trait Protocol

pub trait Protocol:
    Send
    + Sync
    + Send
    + Sync
    + Sized {
    type Request: Framer;
    type Response: Framer;
    type Error: Error + Send + Sync + 'static;

    const VERSION: &'static str;

    // Required method
    fn rpc(
        &mut self,
        frame: Frame<Self::Request>,
    ) -> impl Future<Output = Result<Frame<Self::Response>, Self::Error>> + Send + Sync + Sized;
}

Defines the request and response types for the JetStream protocol.

Required Associated Constants

const VERSION: &'static str

Required Associated Types

type Request: Framer

type Response: Framer

type Error: Error + Send + Sync + 'static

Required Methods

fn rpc( &mut self, frame: FrameSelf::Request, ) -> impl Future<Output = Result<FrameSelf::Response, Self::Error>> + Send + Sync + Sized

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream_rpc

Trait ServiceTransport

pub trait ServiceTransport<P: Protocol>:
    Sink<Frame<P::Response>, Error = P::Error>
    + Stream<Item = Result<Frame<P::Request>, P::Error>>
    + Send
    + Sync
    + Unpin { }

Implementors

impl<P: Protocol, T> ServiceTransport

for Twhere T: Sink<Frame<P::Response>, Error = P::Error> + Stream<Item = Result<Frame<P::Request>, P::Error>> + Send + Sync + Unpin,

Crate jetstream_server

JetStream Server

Feature Flags

  • proxy - Enables the proxy server
  • quic - Enables the QUIC server

Modules

Traits

  • Listener``Stream:

jetstream_server

Module proxy

jetstream_server

Module quic

jetstream_server

Module service

Structs

  • Server``Codec:

Functions

jetstream_server::service

Function run

pub async fn run<T, P>(p: &mut P, stream: T) -> Result<(), P::Error>where
    T: ServiceTransport<P>,
    P: Protocol,

jetstream_server::service

Struct ServerCodec

pub struct ServerCodec<P: Protocol> { /* private fields */ }

Implementations

impl<P: Protocol> ServerCodec

pub fn new() -> Self

Trait Implementations

impl

Decoder for ServerCodec

where P: Protocol,

type Error = Error

The type of unrecoverable frame decoding errors. Read more

type Item = Frame<

::Request>

The type of decoded frames.

fn decode( &mut self, src: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

Attempts to decode a frame from the provided buffer of bytes. Read more

fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<OptionSelf::Item, Self::Error>

A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more

fn framed(self, io: T) -> Framed<T, Self>where T: AsyncRead + AsyncWrite, Self: Sized,

Provides a Stream and Sink interface for reading and writing to thisIo object, using Decode and Encode to read and write the raw data. Read more

impl<P: Protocol> Default for ServerCodec

fn default() -> Self

Returns the “default value” for a type. Read more

impl

Encoder<Frame<

::Response>> for ServerCodec

where P: Protocol,

type Error = Error

The type of encoding errors. Read more

fn encode( &mut self, item: Frame<P::Response>, dst: &mut BytesMut, ) -> Result<(), Self::Error>

Encodes a frame into the buffer provided. Read more

Auto Trait Implementations

impl

Freeze for ServerCodec

impl

RefUnwindSafe for ServerCodec

where P: RefUnwindSafe,

impl

Send for ServerCodec

impl

Sync for ServerCodec

impl

Unpin for ServerCodec

where P: Unpin,

impl

UnwindSafe for ServerCodec

where P: UnwindSafe,

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_server

Trait ListenerStream

pub trait ListenerStream:
    Send
    + Sync
    + Debug
    + 'static {
    type Stream: AsyncRead + AsyncWrite + Unpin + Send + Sync;
    type Addr: Debug;

    // Required method
    fn accept<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(Self::Stream, Self::Addr)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Associated Types

type Stream: AsyncRead + AsyncWrite + Unpin + Send + Sync

type Addr: Debug

Required Methods

fn accept<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(Self::Stream, Self::Addr)>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Implementations on Foreign Types

impl ListenerStream for UnixListener

type Stream = UnixStream

type Addr = SocketAddr

fn accept<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(Self::Stream, Self::Addr)>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Implementors

Crate jetstream_wireformat

Modules

  • wire_``format_``extensions:

Structs

  • Data: A type that encodes an arbitrary number of bytes of data. Typically used for Rread Twrite messages. This differs from a Vec<u8> in that it encodes the number of bytes using a u32 instead of a u16.
  • P9String: A 9P protocol string.

Traits

  • Wire``Format: A type that can be encoded on the wire using the 9P protocol.

Derive Macros

  • JetStream``Wire``Format: Derives wire format encoding for structs

jetstream_wireformat

Derive Macro JetStreamWireFormat

#[derive(JetStreamWireFormat)]

Derives wire format encoding for structs

jetstream_wireformat

Struct Data

#[repr(transparent)]pub struct Data(pub Vec<u8>);

A type that encodes an arbitrary number of bytes of data. Typically used for Rread Twrite messages. This differs from a Vec<u8> in that it encodes the number of bytes using a u32 instead of a u16.

Tuple Fields

0: Vec<u8>

Methods from Deref<Target = Vec>

1.0.0 ·

pub fn capacity(&self) -> usize

Returns the total number of elements the vector can hold without reallocating.

Examples
let mut vec: Vec<i32> = Vec::with_capacity(10);
vec.push(42);
assert!(vec.capacity() >= 10);

1.0.0 ·

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the given Vec<T>. The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1];
vec.reserve(10);
assert!(vec.capacity() >= 11);

1.0.0 ·

pub fn reserve_exact(&mut self, additional: usize)

Reserves the minimum capacity for at least additional more elements to be inserted in the given Vec<T>. Unlike reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling reserve_exact, capacity will be greater than or equal to self.len() + additional. Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1];
vec.reserve_exact(10);
assert!(vec.capacity() >= 11);

1.57.0 ·

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries to reserve capacity for at least additional more elements to be inserted in the given Vec<T>. The collection may reserve more space to speculatively avoid frequent reallocations. After calling try_reserve, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if capacity is already sufficient. This method preserves the contents even if an error occurs.

Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Examples
use std::collections::TryReserveError;

fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
    let mut output = Vec::new();

    // Pre-reserve the memory, exiting if we can't
    output.try_reserve(data.len())?;

    // Now we know this can't OOM in the middle of our complex work
    output.extend(data.iter().map(|&val| {
        val * 2 + 5 // very complicated
    }));

    Ok(output)
}

1.57.0 ·

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Tries to reserve the minimum capacity for at least additionalelements to be inserted in the given Vec<T>. Unlike try_reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling try_reserve_exact, capacity will be greater than or equal to self.len() + additional if it returns Ok(()). Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer try_reserve if future insertions are expected.

Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Examples
use std::collections::TryReserveError;

fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
    let mut output = Vec::new();

    // Pre-reserve the memory, exiting if we can't
    output.try_reserve_exact(data.len())?;

    // Now we know this can't OOM in the middle of our complex work
    output.extend(data.iter().map(|&val| {
        val * 2 + 5 // very complicated
    }));

    Ok(output)
}

1.0.0 ·

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the vector as much as possible.

The behavior of this method depends on the allocator, which may either shrink the vector in-place or reallocate. The resulting vector might still have some excess capacity, just as is the case for with_capacity. See Allocator::shrink for more details.

Examples
let mut vec = Vec::with_capacity(10);
vec.extend([1, 2, 3]);
assert!(vec.capacity() >= 10);
vec.shrink_to_fit();
assert!(vec.capacity() >= 3);

1.56.0 ·

pub fn shrink_to(&mut self, min_capacity: usize)

Shrinks the capacity of the vector with a lower bound.

The capacity will remain at least as large as both the length and the supplied value.

If the current capacity is less than the lower limit, this is a no-op.

Examples
let mut vec = Vec::with_capacity(10);
vec.extend([1, 2, 3]);
assert!(vec.capacity() >= 10);
vec.shrink_to(4);
assert!(vec.capacity() >= 4);
vec.shrink_to(0);
assert!(vec.capacity() >= 3);

1.0.0 ·

pub fn truncate(&mut self, len: usize)

Shortens the vector, keeping the first len elements and dropping the rest.

If len is greater or equal to the vector’s current length, this has no effect.

The drain method can emulate truncate, but causes the excess elements to be returned instead of dropped.

Note that this method has no effect on the allocated capacity of the vector.

Examples

Truncating a five element vector to two elements:

let mut vec = vec![1, 2, 3, 4, 5];
vec.truncate(2);
assert_eq!(vec, [1, 2]);

No truncation occurs when len is greater than the vector’s current length:

let mut vec = vec![1, 2, 3];
vec.truncate(8);
assert_eq!(vec, [1, 2, 3]);

Truncating when len == 0 is equivalent to calling the clearmethod.

let mut vec = vec![1, 2, 3];
vec.truncate(0);
assert_eq!(vec, []);

1.7.0 ·

pub fn as_slice(&self) -> &[T]

Extracts a slice containing the entire vector.

Equivalent to &s[..].

Examples
use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
io::sink().write(buffer.as_slice()).unwrap();

1.7.0 ·

pub fn as_mut_slice(&mut self) -> &mut [T]

Extracts a mutable slice of the entire vector.

Equivalent to &mut s[..].

Examples
use std::io::{self, Read};
let mut buffer = vec![0; 3];
io::repeat(0b101).read_exact(buffer.as_mut_slice()).unwrap();

1.37.0 ·

pub fn as_ptr(&self) -> *const T

Returns a raw pointer to the vector’s buffer, or a dangling raw pointer valid for zero sized reads if the vector didn’t allocate.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up dangling. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying slice, and thus the returned pointer will remain valid when mixed with other calls to as_ptr, as_mut_ptr, and as_non_null. Note that calling other methods that materialize mutable references to the slice, or mutable references to specific elements you are planning on accessing through this pointer, as well as writing to those elements, may still invalidate this pointer. See the second example below for how this guarantee can be used.

Examples
let x = vec![1, 2, 4];
let x_ptr = x.as_ptr();

unsafe {
    for i in 0..x.len() {
        assert_eq!(*x_ptr.add(i), 1 << i);
    }
}

Due to the aliasing guarantee, the following code is legal:

unsafe {
    let mut v = vec![0, 1, 2];
    let ptr1 = v.as_ptr();
    let _ = ptr1.read();
    let ptr2 = v.as_mut_ptr().offset(2);
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`
    // because it mutated a different element:
    let _ = ptr1.read();
}

1.37.0 ·

pub fn as_mut_ptr(&mut self) -> *mut T

Returns a raw mutable pointer to the vector’s buffer, or a dangling raw pointer valid for zero sized reads if the vector didn’t allocate.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up dangling. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying slice, and thus the returned pointer will remain valid when mixed with other calls to as_ptr, as_mut_ptr, and as_non_null. Note that calling other methods that materialize references to the slice, or references to specific elements you are planning on accessing through this pointer, may still invalidate this pointer. See the second example below for how this guarantee can be used.

Examples
// Allocate vector big enough for 4 elements.
let size = 4;
let mut x: Vec<i32> = Vec::with_capacity(size);
let x_ptr = x.as_mut_ptr();

// Initialize elements via raw pointer writes, then set length.
unsafe {
    for i in 0..size {
        *x_ptr.add(i) = i as i32;
    }
    x.set_len(size);
}
assert_eq!(&*x, &[0, 1, 2, 3]);

Due to the aliasing guarantee, the following code is legal:

unsafe {
    let mut v = vec![0];
    let ptr1 = v.as_mut_ptr();
    ptr1.write(1);
    let ptr2 = v.as_mut_ptr();
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
    ptr1.write(3);
}

pub fn as_non_null(&mut self) -> NonNull

🔬This is a nightly-only experimental API. (box_vec_non_null)

Returns a NonNull pointer to the vector’s buffer, or a dangling NonNull pointer valid for zero sized reads if the vector didn’t allocate.

The caller must ensure that the vector outlives the pointer this function returns, or else it will end up dangling. Modifying the vector may cause its buffer to be reallocated, which would also make any pointers to it invalid.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying slice, and thus the returned pointer will remain valid when mixed with other calls to as_ptr, as_mut_ptr, and as_non_null. Note that calling other methods that materialize references to the slice, or references to specific elements you are planning on accessing through this pointer, may still invalidate this pointer. See the second example below for how this guarantee can be used.

Examples
#![feature(box_vec_non_null)]

// Allocate vector big enough for 4 elements.
let size = 4;
let mut x: Vec<i32> = Vec::with_capacity(size);
let x_ptr = x.as_non_null();

// Initialize elements via raw pointer writes, then set length.
unsafe {
    for i in 0..size {
        x_ptr.add(i).write(i as i32);
    }
    x.set_len(size);
}
assert_eq!(&*x, &[0, 1, 2, 3]);

Due to the aliasing guarantee, the following code is legal:

#![feature(box_vec_non_null)]

unsafe {
    let mut v = vec![0];
    let ptr1 = v.as_non_null();
    ptr1.write(1);
    let ptr2 = v.as_non_null();
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
    ptr1.write(3);
}

pub fn allocator(&self) -> &A

🔬This is a nightly-only experimental API. (allocator_api)

Returns a reference to the underlying allocator.1.0.0 ·

pub unsafe fn set_len(&mut self, new_len: usize)

Forces the length of the vector to new_len.

This is a low-level operation that maintains none of the normal invariants of the type. Normally changing the length of a vector is done using one of the safe operations instead, such as truncate, resize, extend, or clear.

Safety
  • new_len must be less than or equal to capacity().
  • The elements at old_len..new_len must be initialized.
Examples

This method can be useful for situations in which the vector is serving as a buffer for other code, particularly over FFI:

pub fn get_dictionary(&self) -> Option<Vec<u8>> {
    // Per the FFI method's docs, "32768 bytes is always enough".
    let mut dict = Vec::with_capacity(32_768);
    let mut dict_length = 0;
    // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that:
    // 1. `dict_length` elements were initialized.
    // 2. `dict_length` <= the capacity (32_768)
    // which makes `set_len` safe to call.
    unsafe {
        // Make the FFI call...
        let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);
        if r == Z_OK {
            // ...and update the length to what was initialized.
            dict.set_len(dict_length);
            Some(dict)
        } else {
            None
        }
    }
}

While the following example is sound, there is a memory leak since the inner vectors were not freed prior to the set_len call:

let mut vec = vec![vec![1, 0, 0],
                   vec![0, 1, 0],
                   vec![0, 0, 1]];
// SAFETY:
// 1. `old_len..0` is empty so no elements need to be initialized.
// 2. `0 <= capacity` always holds whatever `capacity` is.
unsafe {
    vec.set_len(0);
}

Normally, here, one would use clear instead to correctly drop the contents and thus not leak memory.1.0.0 ·

pub fn swap_remove(&mut self, index: usize) -> T

Removes an element from the vector and returns it.

The removed element is replaced by the last element of the vector.

This does not preserve ordering of the remaining elements, but is O(1). If you need to preserve the element order, use remove instead.

Panics

Panics if index is out of bounds.

Examples
let mut v = vec!["foo", "bar", "baz", "qux"];

assert_eq!(v.swap_remove(1), "bar");
assert_eq!(v, ["foo", "qux", "baz"]);

assert_eq!(v.swap_remove(0), "foo");
assert_eq!(v, ["baz", "qux"]);

1.0.0 ·

pub fn insert(&mut self, index: usize, element: T)

Inserts an element at position index within the vector, shifting all elements after it to the right.

Panics

Panics if index > len.

Examples
let mut vec = vec![1, 2, 3];
vec.insert(1, 4);
assert_eq!(vec, [1, 4, 2, 3]);
vec.insert(4, 5);
assert_eq!(vec, [1, 4, 2, 3, 5]);
Time complexity

Takes O( Vec::len) time. All items after the insertion index must be shifted to the right. In the worst case, all elements are shifted when the insertion index is 0.1.0.0 ·

pub fn remove(&mut self, index: usize) -> T

Removes and returns the element at position index within the vector, shifting all elements after it to the left.

Note: Because this shifts over the remaining elements, it has a worst-case performance of O( n). If you don’t need the order of elements to be preserved, use swap_remove instead. If you’d like to remove elements from the beginning of the Vec, consider using VecDeque::pop_front instead.

Panics

Panics if index is out of bounds.

Examples
let mut v = vec![1, 2, 3];
assert_eq!(v.remove(1), 2);
assert_eq!(v, [1, 3]);

1.0.0 ·

pub fn retain(&mut self, f: F)where F: FnMut(&T) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all elements e for which f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Examples
let mut vec = vec![1, 2, 3, 4];
vec.retain(|&x| x % 2 == 0);
assert_eq!(vec, [2, 4]);

Because the elements are visited exactly once in the original order, external state may be used to decide which elements to keep.

let mut vec = vec![1, 2, 3, 4, 5];
let keep = [false, true, true, false, true];
let mut iter = keep.iter();
vec.retain(|_| *iter.next().unwrap());
assert_eq!(vec, [2, 3, 5]);

1.61.0 ·

pub fn retain_mut(&mut self, f: F)where F: FnMut(&mut T) -> bool,

Retains only the elements specified by the predicate, passing a mutable reference to it.

In other words, remove all elements e such that f(&mut e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

Examples
let mut vec = vec![1, 2, 3, 4];
vec.retain_mut(|x| if *x <= 3 {
    *x += 1;
    true
} else {
    false
});
assert_eq!(vec, [2, 3, 4]);

1.16.0 ·

pub fn dedup_by_key<F, K>(&mut self, key: F)where F: FnMut(&mut T) -> K, K: PartialEq,

Removes all but the first of consecutive elements in the vector that resolve to the same key.

If the vector is sorted, this removes all duplicates.

Examples
let mut vec = vec![10, 20, 21, 30, 20];

vec.dedup_by_key(|i| *i / 10);

assert_eq!(vec, [10, 20, 30, 20]);

1.16.0 ·

pub fn dedup_by(&mut self, same_bucket: F)where F: FnMut(&mut T, &mut T) -> bool,

Removes all but the first of consecutive elements in the vector satisfying a given equality relation.

The same_bucket function is passed references to two elements from the vector and must determine if the elements compare equal. The elements are passed in opposite order from their order in the slice, so if same_bucket(a, b) returns true, a is removed.

If the vector is sorted, this removes all duplicates.

Examples
let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];

vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));

assert_eq!(vec, ["foo", "bar", "baz", "bar"]);

1.0.0 ·

pub fn push(&mut self, value: T)

Appends an element to the back of a collection.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1, 2];
vec.push(3);
assert_eq!(vec, [1, 2, 3]);
Time complexity

Takes amortized O(1) time. If the vector’s length would exceed its capacity after the push, O( capacity) time is taken to copy the vector’s elements to a larger allocation. This expensive operation is offset by the capacity O(1) insertions it allows.

pub fn push_within_capacity(&mut self, value: T) -> Result<(), T>

🔬This is a nightly-only experimental API. (vec_push_within_capacity)

Appends an element if there is sufficient spare capacity, otherwise an error is returned with the element.

Unlike push this method will not reallocate when there’s insufficient capacity. The caller should use reserve or try_reserve to ensure that there is enough capacity.

Examples

A manual, panic-free alternative to FromIterator:

#![feature(vec_push_within_capacity)]

use std::collections::TryReserveError;
fn from_iter_fallible<T>(iter: impl Iterator<Item=T>) -> Result<Vec<T>, TryReserveError> {
    let mut vec = Vec::new();
    for value in iter {
        if let Err(value) = vec.push_within_capacity(value) {
            vec.try_reserve(1)?;
            // this cannot fail, the previous line either returned or added at least 1 free slot
            let _ = vec.push_within_capacity(value);
        }
    }
    Ok(vec)
}
assert_eq!(from_iter_fallible(0..100), Ok(Vec::from_iter(0..100)));
Time complexity

Takes O(1) time.1.0.0 ·

pub fn pop(&mut self) -> Option

Removes the last element from a vector and returns it, or None if it is empty.

If you’d like to pop the first element, consider using VecDeque::pop_front instead.

Examples
let mut vec = vec![1, 2, 3];
assert_eq!(vec.pop(), Some(3));
assert_eq!(vec, [1, 2]);
Time complexity

Takes O(1) time.

pub fn pop_if(&mut self, f: F) -> Optionwhere F: FnOnce(&mut T) -> bool,

🔬This is a nightly-only experimental API. (vec_pop_if)

Removes and returns the last element in a vector if the predicate returns true, or None if the predicate returns false or the vector is empty.

Examples
#![feature(vec_pop_if)]

let mut vec = vec![1, 2, 3, 4];
let pred = |x: &mut i32| *x % 2 == 0;

assert_eq!(vec.pop_if(pred), Some(4));
assert_eq!(vec, [1, 2, 3]);
assert_eq!(vec.pop_if(pred), None);

1.4.0 ·

pub fn append(&mut self, other: &mut Vec<T, A>)

Moves all the elements of other into self, leaving other empty.

Panics

Panics if the new capacity exceeds isize::MAX bytes.

Examples
let mut vec = vec![1, 2, 3];
let mut vec2 = vec![4, 5, 6];
vec.append(&mut vec2);
assert_eq!(vec, [1, 2, 3, 4, 5, 6]);
assert_eq!(vec2, []);

1.6.0 ·

pub fn drain(&mut self, range: R) -> Drain<'_, T, A>where R: RangeBounds,

Removes the specified range from the vector in bulk, returning all removed elements as an iterator. If the iterator is dropped before being fully consumed, it drops the remaining removed elements.

The returned iterator keeps a mutable borrow on the vector to optimize its implementation.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Leaking

If the returned iterator goes out of scope without being dropped (due to mem::forget, for example), the vector may have lost and leaked elements arbitrarily, including elements outside the range.

Examples
let mut v = vec![1, 2, 3];
let u: Vec<_> = v.drain(1..).collect();
assert_eq!(v, &[1]);
assert_eq!(u, &[2, 3]);

// A full range clears the vector, like `clear()` does
v.drain(..);
assert_eq!(v, &[]);

1.0.0 ·

pub fn clear(&mut self)

Clears the vector, removing all values.

Note that this method has no effect on the allocated capacity of the vector.

Examples
let mut v = vec![1, 2, 3];

v.clear();

assert!(v.is_empty());

1.0.0 ·

pub fn len(&self) -> usize

Returns the number of elements in the vector, also referred to as its ‘length’.

Examples
let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);

1.0.0 ·

pub fn is_empty(&self) -> bool

Returns true if the vector contains no elements.

Examples
let mut v = Vec::new();
assert!(v.is_empty());

v.push(1);
assert!(!v.is_empty());

1.4.0 ·

pub fn split_off(&mut self, at: usize) -> Vec<T, A>where A: Clone,

Splits the collection into two at the given index.

Returns a newly allocated vector containing the elements in the range [at, len). After the call, the original vector will be left containing the elements [0, at) with its previous capacity unchanged.

  • If you want to take ownership of the entire contents and capacity of the vector, see mem::take or mem::replace.
  • If you don’t need the returned vector at all, see Vec::truncate.
  • If you want to take ownership of an arbitrary subslice, or you don’t necessarily want to store the removed items in a vector, see Vec::drain.
Panics

Panics if at > len.

Examples
let mut vec = vec![1, 2, 3];
let vec2 = vec.split_off(1);
assert_eq!(vec, [1]);
assert_eq!(vec2, [2, 3]);

1.33.0 ·

pub fn resize_with(&mut self, new_len: usize, f: F)where F: FnMut() -> T,

Resizes the Vec in-place so that len is equal to new_len.

If new_len is greater than len, the Vec is extended by the difference, with each additional slot filled with the result of calling the closure f. The return values from f will end up in the Vec in the order they have been generated.

If new_len is less than len, the Vec is simply truncated.

This method uses a closure to create new values on every push. If you’d rather Clone a given value, use Vec::resize. If you want to use the Default trait to generate values, you can pass Default::default as the second argument.

Examples
let mut vec = vec![1, 2, 3];
vec.resize_with(5, Default::default);
assert_eq!(vec, [1, 2, 3, 0, 0]);

let mut vec = vec![];
let mut p = 1;
vec.resize_with(4, || { p *= 2; p });
assert_eq!(vec, [2, 4, 8, 16]);

1.60.0 ·

pub fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit]

Returns the remaining spare capacity of the vector as a slice of MaybeUninit<T>.

The returned slice can be used to fill the vector with data (e.g. by reading from a file) before marking the data as initialized using the set_len method.

Examples
// Allocate vector big enough for 10 elements.
let mut v = Vec::with_capacity(10);

// Fill in the first 3 elements.
let uninit = v.spare_capacity_mut();
uninit[0].write(0);
uninit[1].write(1);
uninit[2].write(2);

// Mark the first 3 elements of the vector as being initialized.
unsafe {
    v.set_len(3);
}

assert_eq!(&v, &[0, 1, 2]);

pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit])

🔬This is a nightly-only experimental API. (vec_split_at_spare)

Returns vector content as a slice of T, along with the remaining spare capacity of the vector as a slice of MaybeUninit<T>.

The returned spare capacity slice can be used to fill the vector with data (e.g. by reading from a file) before marking the data as initialized using the set_len method.

Note that this is a low-level API, which should be used with care for optimization purposes. If you need to append data to a Vecyou can use push, extend, extend_from_slice, extend_from_within, insert, append, resize or resize_with, depending on your exact needs.

Examples
#![feature(vec_split_at_spare)]

let mut v = vec![1, 1, 2];

// Reserve additional space big enough for 10 elements.
v.reserve(10);

let (init, uninit) = v.split_at_spare_mut();
let sum = init.iter().copied().sum::<u32>();

// Fill in the next 4 elements.
uninit[0].write(sum);
uninit[1].write(sum * 2);
uninit[2].write(sum * 3);
uninit[3].write(sum * 4);

// Mark the 4 elements of the vector as being initialized.
unsafe {
    let len = v.len();
    v.set_len(len + 4);
}

assert_eq!(&v, &[1, 1, 2, 4, 8, 12, 16]);

1.5.0 ·

pub fn resize(&mut self, new_len: usize, value: T)

Resizes the Vec in-place so that len is equal to new_len.

If new_len is greater than len, the Vec is extended by the difference, with each additional slot filled with value. If new_len is less than len, the Vec is simply truncated.

This method requires T to implement Clone, in order to be able to clone the passed value. If you need more flexibility (or want to rely on Default instead of Clone), use Vec::resize_with. If you only need to resize to a smaller size, use Vec::truncate.

Examples
let mut vec = vec!["hello"];
vec.resize(3, "world");
assert_eq!(vec, ["hello", "world", "world"]);

let mut vec = vec![1, 2, 3, 4];
vec.resize(2, 0);
assert_eq!(vec, [1, 2]);

1.6.0 ·

pub fn extend_from_slice(&mut self, other: &[T])

Clones and appends all elements in a slice to the Vec.

Iterates over the slice other, clones each element, and then appends it to this Vec. The other slice is traversed in-order.

Note that this function is same as extend except that it is specialized to work with slices instead. If and when Rust gets specialization this function will likely be deprecated (but still available).

Examples
let mut vec = vec![1];
vec.extend_from_slice(&[2, 3, 4]);
assert_eq!(vec, [1, 2, 3, 4]);

1.53.0 ·

pub fn extend_from_within(&mut self, src: R)where R: RangeBounds,

Copies elements from src range to the end of the vector.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
let mut vec = vec![0, 1, 2, 3, 4];

vec.extend_from_within(2..);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4]);

vec.extend_from_within(..2);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1]);

vec.extend_from_within(4..8);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1, 4, 2, 3, 4]);

1.0.0 ·

pub fn dedup(&mut self)

Removes consecutive repeated elements in the vector according to the PartialEq trait implementation.

If the vector is sorted, this removes all duplicates.

Examples
let mut vec = vec![1, 2, 2, 3, 2];

vec.dedup();

assert_eq!(vec, [1, 2, 3, 2]);

1.21.0 ·

pub fn splice<R, I>( &mut self, range: R, replace_with: I, ) -> Splice<'_, ::IntoIter, A>where R: RangeBounds, I: IntoIterator<Item = T>,

Creates a splicing iterator that replaces the specified range in the vector with the given replace_with iterator and yields the removed items. replace_with does not need to be the same length as range.

range is removed even if the iterator is not consumed until the end.

It is unspecified how many elements are removed from the vector if the Splice value is leaked.

The input iterator replace_with is only consumed when the Splice value is dropped.

This is optimal if:

  • The tail (elements in the vector after range) is empty,
  • or replace_with yields fewer or equal elements than range’s length
  • or the lower bound of its size_hint() is exact.

Otherwise, a temporary vector is allocated and the tail is moved twice.

Panics

Panics if the starting point is greater than the end point or if the end point is greater than the length of the vector.

Examples
let mut v = vec![1, 2, 3, 4];
let new = [7, 8, 9];
let u: Vec<_> = v.splice(1..3, new).collect();
assert_eq!(v, &[1, 7, 8, 9, 4]);
assert_eq!(u, &[2, 3]);

pub fn extract_if(&mut self, filter: F) -> ExtractIf<'_, T, F, A>where F: FnMut(&mut T) -> bool,

🔬This is a nightly-only experimental API. (extract_if)

Creates an iterator which uses a closure to determine if an element should be removed.

If the closure returns true, then the element is removed and yielded. If the closure returns false, the element will remain in the vector and will not be yielded by the iterator.

If the returned ExtractIf is not exhausted, e.g. because it is dropped without iterating or the iteration short-circuits, then the remaining elements will be retained. Use retain with a negated predicate if you do not need the returned iterator.

Using this method is equivalent to the following code:

let mut i = 0;
while i < vec.len() {
    if some_predicate(&mut vec[i]) {
        let val = vec.remove(i);
        // your code here
    } else {
        i += 1;
    }
}

But extract_if is easier to use. extract_if is also more efficient, because it can backshift the elements of the array in bulk.

Note that extract_if also lets you mutate every element in the filter closure, regardless of whether you choose to keep or remove it.

Examples

Splitting an array into evens and odds, reusing the original allocation:

#![feature(extract_if)]
let mut numbers = vec![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15];

let evens = numbers.extract_if(|x| *x % 2 == 0).collect::<Vec<_>>();
let odds = numbers;

assert_eq!(evens, vec![2, 4, 6, 8, 14]);
assert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]);

Methods from Deref<Target = [T]>

pub fn as_str(&self) -> &str

🔬This is a nightly-only experimental API. (ascii_char)

Views this slice of ASCII characters as a UTF-8 str.

pub fn as_bytes(&self) -> &[u8] ⓘ

🔬This is a nightly-only experimental API. (ascii_char)

Views this slice of ASCII characters as a slice of u8 bytes.1.23.0 ·

pub fn is_ascii(&self) -> bool

Checks if all bytes in this slice are within the ASCII range.

pub fn as_ascii(&self) -> Option<&[AsciiChar]>

🔬This is a nightly-only experimental API. (ascii_char)

If this slice is_ascii, returns it as a slice of ASCII characters, otherwise returns None.

pub unsafe fn as_ascii_unchecked(&self) -> &[AsciiChar]

🔬This is a nightly-only experimental API. (ascii_char)

Converts this slice of bytes into a slice of ASCII characters, without checking whether they’re valid.

Safety

Every byte in the slice must be in 0..=127, or else this is UB.1.23.0 ·

pub fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool

Checks that two slices are an ASCII case-insensitive match.

Same as to_ascii_lowercase(a) == to_ascii_lowercase(b), but without allocating and copying temporaries.1.23.0 ·

pub fn make_ascii_uppercase(&mut self)

Converts this slice to its ASCII upper case equivalent in-place.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

To return a new uppercased value without modifying the existing one, use to_ascii_uppercase.1.23.0 ·

pub fn make_ascii_lowercase(&mut self)

Converts this slice to its ASCII lower case equivalent in-place.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

To return a new lowercased value without modifying the existing one, use to_ascii_lowercase.1.60.0 ·

pub fn escape_ascii(&self) -> EscapeAscii<'_>

Returns an iterator that produces an escaped version of this slice, treating it as an ASCII string.

Examples

let s = b"0\t\r\n'\"\\\x9d";
let escaped = s.escape_ascii().to_string();
assert_eq!(escaped, "0\\t\\r\\n\\'\\\"\\\\\\x9d");

1.80.0 ·

pub fn trim_ascii_start(&self) -> &[u8] ⓘ

Returns a byte slice with leading ASCII whitespace bytes removed.

‘Whitespace’ refers to the definition used by u8::is_ascii_whitespace.

Examples
assert_eq!(b" \t hello world\n".trim_ascii_start(), b"hello world\n");
assert_eq!(b"  ".trim_ascii_start(), b"");
assert_eq!(b"".trim_ascii_start(), b"");

1.80.0 ·

pub fn trim_ascii_end(&self) -> &[u8] ⓘ

Returns a byte slice with trailing ASCII whitespace bytes removed.

‘Whitespace’ refers to the definition used by u8::is_ascii_whitespace.

Examples
assert_eq!(b"\r hello world\n ".trim_ascii_end(), b"\r hello world");
assert_eq!(b"  ".trim_ascii_end(), b"");
assert_eq!(b"".trim_ascii_end(), b"");

1.80.0 ·

pub fn trim_ascii(&self) -> &[u8] ⓘ

Returns a byte slice with leading and trailing ASCII whitespace bytes removed.

‘Whitespace’ refers to the definition used by u8::is_ascii_whitespace.

Examples
assert_eq!(b"\r hello world\n ".trim_ascii(), b"hello world");
assert_eq!(b"  ".trim_ascii(), b"");
assert_eq!(b"".trim_ascii(), b"");

1.0.0 ·

pub fn len(&self) -> usize

Returns the number of elements in the slice.

Examples
let a = [1, 2, 3];
assert_eq!(a.len(), 3);

1.0.0 ·

pub fn is_empty(&self) -> bool

Returns true if the slice has a length of 0.

Examples
let a = [1, 2, 3];
assert!(!a.is_empty());

let b: &[i32] = &[];
assert!(b.is_empty());

1.0.0 ·

pub fn first(&self) -> Option<&T>

Returns the first element of the slice, or None if it is empty.

Examples
let v = [10, 40, 30];
assert_eq!(Some(&10), v.first());

let w: &[i32] = &[];
assert_eq!(None, w.first());

1.0.0 ·

pub fn first_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the first element of the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some(first) = x.first_mut() {
    *first = 5;
}
assert_eq!(x, &[5, 1, 2]);

let y: &mut [i32] = &mut [];
assert_eq!(None, y.first_mut());

1.5.0 ·

pub fn split_first(&self) -> Option<(&T, &[T])>

Returns the first and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &[0, 1, 2];

if let Some((first, elements)) = x.split_first() {
    assert_eq!(first, &0);
    assert_eq!(elements, &[1, 2]);
}

1.5.0 ·

pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])>

Returns the first and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some((first, elements)) = x.split_first_mut() {
    *first = 3;
    elements[0] = 4;
    elements[1] = 5;
}
assert_eq!(x, &[3, 4, 5]);

1.5.0 ·

pub fn split_last(&self) -> Option<(&T, &[T])>

Returns the last and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &[0, 1, 2];

if let Some((last, elements)) = x.split_last() {
    assert_eq!(last, &2);
    assert_eq!(elements, &[0, 1]);
}

1.5.0 ·

pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])>

Returns the last and all the rest of the elements of the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some((last, elements)) = x.split_last_mut() {
    *last = 3;
    elements[0] = 4;
    elements[1] = 5;
}
assert_eq!(x, &[4, 5, 3]);

1.0.0 ·

pub fn last(&self) -> Option<&T>

Returns the last element of the slice, or None if it is empty.

Examples
let v = [10, 40, 30];
assert_eq!(Some(&30), v.last());

let w: &[i32] = &[];
assert_eq!(None, w.last());

1.0.0 ·

pub fn last_mut(&mut self) -> Option<&mut T>

Returns a mutable reference to the last item in the slice, or None if it is empty.

Examples
let x = &mut [0, 1, 2];

if let Some(last) = x.last_mut() {
    *last = 10;
}
assert_eq!(x, &[0, 1, 10]);

let y: &mut [i32] = &mut [];
assert_eq!(None, y.last_mut());

1.77.0 ·

pub fn first_chunk(&self) -> Option<&[T; N]>

Returns an array reference to the first N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let u = [10, 40, 30];
assert_eq!(Some(&[10, 40]), u.first_chunk::<2>());

let v: &[i32] = &[10];
assert_eq!(None, v.first_chunk::<2>());

let w: &[i32] = &[];
assert_eq!(Some(&[]), w.first_chunk::<0>());

1.77.0 ·

pub fn first_chunk_mut(&mut self) -> Option<&mut [T; N]>

Returns a mutable array reference to the first N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some(first) = x.first_chunk_mut::<2>() {
    first[0] = 5;
    first[1] = 4;
}
assert_eq!(x, &[5, 4, 2]);

assert_eq!(None, x.first_chunk_mut::<4>());

1.77.0 ·

pub fn split_first_chunk(&self) -> Option<(&[T; N], &[T])>

Returns an array reference to the first N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &[0, 1, 2];

if let Some((first, elements)) = x.split_first_chunk::<2>() {
    assert_eq!(first, &[0, 1]);
    assert_eq!(elements, &[2]);
}

assert_eq!(None, x.split_first_chunk::<4>());

1.77.0 ·

pub fn split_first_chunk_mut( &mut self, ) -> Option<(&mut [T; N], &mut [T])>

Returns a mutable array reference to the first N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some((first, elements)) = x.split_first_chunk_mut::<2>() {
    first[0] = 3;
    first[1] = 4;
    elements[0] = 5;
}
assert_eq!(x, &[3, 4, 5]);

assert_eq!(None, x.split_first_chunk_mut::<4>());

1.77.0 ·

pub fn split_last_chunk(&self) -> Option<(&[T], &[T; N])>

Returns an array reference to the last N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &[0, 1, 2];

if let Some((elements, last)) = x.split_last_chunk::<2>() {
    assert_eq!(elements, &[0]);
    assert_eq!(last, &[1, 2]);
}

assert_eq!(None, x.split_last_chunk::<4>());

1.77.0 ·

pub fn split_last_chunk_mut( &mut self, ) -> Option<(&mut [T], &mut [T; N])>

Returns a mutable array reference to the last N items in the slice and the remaining slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some((elements, last)) = x.split_last_chunk_mut::<2>() {
    last[0] = 3;
    last[1] = 4;
    elements[0] = 5;
}
assert_eq!(x, &[5, 3, 4]);

assert_eq!(None, x.split_last_chunk_mut::<4>());

1.77.0 ·

pub fn last_chunk(&self) -> Option<&[T; N]>

Returns an array reference to the last N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let u = [10, 40, 30];
assert_eq!(Some(&[40, 30]), u.last_chunk::<2>());

let v: &[i32] = &[10];
assert_eq!(None, v.last_chunk::<2>());

let w: &[i32] = &[];
assert_eq!(Some(&[]), w.last_chunk::<0>());

1.77.0 ·

pub fn last_chunk_mut(&mut self) -> Option<&mut [T; N]>

Returns a mutable array reference to the last N items in the slice.

If the slice is not at least N in length, this will return None.

Examples
let x = &mut [0, 1, 2];

if let Some(last) = x.last_chunk_mut::<2>() {
    last[0] = 10;
    last[1] = 20;
}
assert_eq!(x, &[0, 10, 20]);

assert_eq!(None, x.last_chunk_mut::<4>());

1.0.0 ·

pub fn get(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output>where I: SliceIndex<[T]>,

Returns a reference to an element or subslice depending on the type of index.

  • If given a position, returns a reference to the element at that position or None if out of bounds.
  • If given a range, returns the subslice corresponding to that range, or None if out of bounds.
Examples
let v = [10, 40, 30];
assert_eq!(Some(&40), v.get(1));
assert_eq!(Some(&[10, 40][..]), v.get(0..2));
assert_eq!(None, v.get(3));
assert_eq!(None, v.get(0..4));

1.0.0 ·

pub fn get_mut( &mut self, index: I, ) -> Option<&mut <I as SliceIndex<[T]>>::Output>where I: SliceIndex<[T]>,

Returns a mutable reference to an element or subslice depending on the type of index (see get) or None if the index is out of bounds.

Examples
let x = &mut [0, 1, 2];

if let Some(elem) = x.get_mut(1) {
    *elem = 42;
}
assert_eq!(x, &[0, 42, 2]);

1.0.0 ·

pub unsafe fn get_unchecked( &self, index: I, ) -> &<I as SliceIndex<[T]>>::Outputwhere I: SliceIndex<[T]>,

Returns a reference to an element or subslice, without doing bounds checking.

For a safe alternative see get.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used.

You can think of this like .get(index).unwrap_unchecked(). It’s UB to call .get_unchecked(len), even if you immediately convert to a pointer. And it’s UB to call .get_unchecked(..len + 1), .get_unchecked(..=len), or similar.

Examples
let x = &[1, 2, 4];

unsafe {
    assert_eq!(x.get_unchecked(1), &2);
}

1.0.0 ·

pub unsafe fn get_unchecked_mut( &mut self, index: I, ) -> &mut <I as SliceIndex<[T]>>::Outputwhere I: SliceIndex<[T]>,

Returns a mutable reference to an element or subslice, without doing bounds checking.

For a safe alternative see get_mut.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used.

You can think of this like .get_mut(index).unwrap_unchecked(). It’s UB to call .get_unchecked_mut(len), even if you immediately convert to a pointer. And it’s UB to call .get_unchecked_mut(..len + 1), .get_unchecked_mut(..=len), or similar.

Examples
let x = &mut [1, 2, 4];

unsafe {
    let elem = x.get_unchecked_mut(1);
    *elem = 13;
}
assert_eq!(x, &[1, 13, 4]);

1.0.0 ·

pub fn as_ptr(&self) -> *const T

Returns a raw pointer to the slice’s buffer.

The caller must ensure that the slice outlives the pointer this function returns, or else it will end up dangling.

The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.

Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.

Examples
let x = &[1, 2, 4];
let x_ptr = x.as_ptr();

unsafe {
    for i in 0..x.len() {
        assert_eq!(x.get_unchecked(i), &*x_ptr.add(i));
    }
}

1.0.0 ·

pub fn as_mut_ptr(&mut self) -> *mut T

Returns an unsafe mutable pointer to the slice’s buffer.

The caller must ensure that the slice outlives the pointer this function returns, or else it will end up dangling.

Modifying the container referenced by this slice may cause its buffer to be reallocated, which would also make any pointers to it invalid.

Examples
let x = &mut [1, 2, 4];
let x_ptr = x.as_mut_ptr();

unsafe {
    for i in 0..x.len() {
        *x_ptr.add(i) += 2;
    }
}
assert_eq!(x, &[3, 4, 6]);

1.48.0 ·

pub fn as_ptr_range(&self) -> Range<*const T>

Returns the two raw pointers spanning the slice.

The returned range is half-open, which means that the end pointer points one past the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.

See as_ptr for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.

This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.

It can also be useful to check if a pointer to an element refers to an element of this slice:

let a = [1, 2, 3];
let x = &a[1] as *const _;
let y = &5 as *const _;

assert!(a.as_ptr_range().contains(&x));
assert!(!a.as_ptr_range().contains(&y));

1.48.0 ·

pub fn as_mut_ptr_range(&mut self) -> Range<*mut T>

Returns the two unsafe mutable pointers spanning the slice.

The returned range is half-open, which means that the end pointer points one past the last element of the slice. This way, an empty slice is represented by two equal pointers, and the difference between the two pointers represents the size of the slice.

See as_mut_ptr for warnings on using these pointers. The end pointer requires extra caution, as it does not point to a valid element in the slice.

This function is useful for interacting with foreign interfaces which use two pointers to refer to a range of elements in memory, as is common in C++.1.0.0 ·

pub fn swap(&mut self, a: usize, b: usize)

Swaps two elements in the slice.

If a equals to b, it’s guaranteed that elements won’t change value.

Arguments
  • a - The index of the first element
  • b - The index of the second element
Panics

Panics if a or b are out of bounds.

Examples
let mut v = ["a", "b", "c", "d", "e"];
v.swap(2, 4);
assert!(v == ["a", "b", "e", "d", "c"]);

pub unsafe fn swap_unchecked(&mut self, a: usize, b: usize)

🔬This is a nightly-only experimental API. (slice_swap_unchecked)

Swaps two elements in the slice, without doing bounds checking.

For a safe alternative see swap.

Arguments
  • a - The index of the first element
  • b - The index of the second element
Safety

Calling this method with an out-of-bounds index is undefined behavior. The caller has to ensure that a < self.len() and b < self.len().

Examples
#![feature(slice_swap_unchecked)]

let mut v = ["a", "b", "c", "d"];
// SAFETY: we know that 1 and 3 are both indices of the slice
unsafe { v.swap_unchecked(1, 3) };
assert!(v == ["a", "d", "c", "b"]);

1.0.0 ·

pub fn reverse(&mut self)

Reverses the order of elements in the slice, in place.

Examples
let mut v = [1, 2, 3];
v.reverse();
assert!(v == [3, 2, 1]);

1.0.0 ·

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the slice.

The iterator yields all items from start to end.

Examples
let x = &[1, 2, 4];
let mut iterator = x.iter();

assert_eq!(iterator.next(), Some(&1));
assert_eq!(iterator.next(), Some(&2));
assert_eq!(iterator.next(), Some(&4));
assert_eq!(iterator.next(), None);

1.0.0 ·

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns an iterator that allows modifying each value.

The iterator yields all items from start to end.

Examples
let x = &mut [1, 2, 4];
for elem in x.iter_mut() {
    *elem += 2;
}
assert_eq!(x, &[3, 4, 6]);

1.0.0 ·

pub fn windows(&self, size: usize) -> Windows<'_, T>

Returns an iterator over all contiguous windows of length size. The windows overlap. If the slice is shorter than size, the iterator returns no values.

Panics

Panics if size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.windows(3);
assert_eq!(iter.next().unwrap(), &['l', 'o', 'r']);
assert_eq!(iter.next().unwrap(), &['o', 'r', 'e']);
assert_eq!(iter.next().unwrap(), &['r', 'e', 'm']);
assert!(iter.next().is_none());

If the slice is shorter than size:

let slice = ['f', 'o', 'o'];
let mut iter = slice.windows(4);
assert!(iter.next().is_none());

There’s no windows_mut, as that existing would let safe code violate the “only one &mut at a time to the same thing” rule. However, you can sometimes use Cell::as_slice_of_cells in conjunction with windows to accomplish something similar:

use std::cell::Cell;

let mut array = ['R', 'u', 's', 't', ' ', '2', '0', '1', '5'];
let slice = &mut array[..];
let slice_of_cells: &[Cell<char>] = Cell::from_mut(slice).as_slice_of_cells();
for w in slice_of_cells.windows(3) {
    Cell::swap(&w[0], &w[2]);
}
assert_eq!(array, ['s', 't', ' ', '2', '0', '1', '5', 'u', 'R']);

1.0.0 ·

pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See chunks_exact for a variant of this iterator that returns chunks of always exactly chunk_size elements, and rchunks for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert_eq!(iter.next().unwrap(), &['m']);
assert!(iter.next().is_none());

1.0.0 ·

pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See chunks_exact_mut for a variant of this iterator that returns chunks of always exactly chunk_size elements, and rchunks_mut for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.chunks_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 3]);

1.31.0 ·

pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of chunks.

See chunks for a variant of this iterator that also returns the remainder as a smaller chunk, and rchunks_exact for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.chunks_exact(2);
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);

1.31.0 ·

pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the beginning of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the into_remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of chunks_mut.

See chunks_mut for a variant of this iterator that also returns the remainder as a smaller chunk, and rchunks_exact_mut for the same iterator but starting at the end of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.chunks_exact_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 0]);

pub unsafe fn as_chunks_unchecked(&self) -> &[[T; N]]

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, assuming that there’s no remainder.

Safety

This may only be called when

  • The slice splits exactly into N-element chunks (aka self.len() % N == 0).
  • N != 0.
Examples
#![feature(slice_as_chunks)]
let slice: &[char] = &['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &[[char; 1]] =
    // SAFETY: 1-element chunks never have remainder
    unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &[[char; 3]] =
    // SAFETY: The slice length (6) is a multiple of 3
    unsafe { slice.as_chunks_unchecked() };
assert_eq!(chunks, &[['l', 'o', 'r'], ['e', 'm', '!']]);

// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed

pub fn as_chunks(&self) -> (&[[T; N]], &[T])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (chunks, remainder) = slice.as_chunks();
assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]);
assert_eq!(remainder, &['m']);

If you expect the slice to be an exact multiple, you can combine let- else with an empty slice pattern:

#![feature(slice_as_chunks)]
let slice = ['R', 'u', 's', 't'];
let (chunks, []) = slice.as_chunks::<2>() else {
    panic!("slice didn't have even length")
};
assert_eq!(chunks, &[['R', 'u'], ['s', 't']]);

pub fn as_rchunks(&self) -> (&[T], &[[T; N]])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let (remainder, chunks) = slice.as_rchunks();
assert_eq!(remainder, &['l']);
assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]);

pub fn array_chunks(&self) -> ArrayChunks<'_, T, N>

🔬This is a nightly-only experimental API. (array_chunks)

Returns an iterator over N elements of the slice at a time, starting at the beginning of the slice.

The chunks are array references and do not overlap. If N does not divide the length of the slice, then the last up to N-1 elements will be omitted and can be retrieved from the remainder function of the iterator.

This method is the const generic equivalent of chunks_exact.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(array_chunks)]
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.array_chunks();
assert_eq!(iter.next().unwrap(), &['l', 'o']);
assert_eq!(iter.next().unwrap(), &['r', 'e']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['m']);

pub unsafe fn as_chunks_unchecked_mut( &mut self, ) -> &mut [[T; N]]

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, assuming that there’s no remainder.

Safety

This may only be called when

  • The slice splits exactly into N-element chunks (aka self.len() % N == 0).
  • N != 0.
Examples
#![feature(slice_as_chunks)]
let slice: &mut [char] = &mut ['l', 'o', 'r', 'e', 'm', '!'];
let chunks: &mut [[char; 1]] =
    // SAFETY: 1-element chunks never have remainder
    unsafe { slice.as_chunks_unchecked_mut() };
chunks[0] = ['L'];
assert_eq!(chunks, &[['L'], ['o'], ['r'], ['e'], ['m'], ['!']]);
let chunks: &mut [[char; 3]] =
    // SAFETY: The slice length (6) is a multiple of 3
    unsafe { slice.as_chunks_unchecked_mut() };
chunks[1] = ['a', 'x', '?'];
assert_eq!(slice, &['L', 'o', 'r', 'a', 'x', '?']);

// These would be unsound:
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed

pub fn as_chunks_mut(&mut self) -> (&mut [[T; N]], &mut [T])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

let (chunks, remainder) = v.as_chunks_mut();
remainder[0] = 9;
for chunk in chunks {
    *chunk = [count; 2];
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 9]);

pub fn as_rchunks_mut(&mut self) -> (&mut [T], &mut [[T; N]])

🔬This is a nightly-only experimental API. (slice_as_chunks)

Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(slice_as_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

let (remainder, chunks) = v.as_rchunks_mut();
remainder[0] = 9;
for chunk in chunks {
    *chunk = [count; 2];
    count += 1;
}
assert_eq!(v, &[9, 1, 1, 2, 2]);

pub fn array_chunks_mut(&mut self) -> ArrayChunksMut<'_, T, N>

🔬This is a nightly-only experimental API. (array_chunks)

Returns an iterator over N elements of the slice at a time, starting at the beginning of the slice.

The chunks are mutable array references and do not overlap. If N does not divide the length of the slice, then the last up to N-1 elements will be omitted and can be retrieved from the into_remainder function of the iterator.

This method is the const generic equivalent of chunks_exact_mut.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(array_chunks)]
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.array_chunks_mut() {
    *chunk = [count; 2];
    count += 1;
}
assert_eq!(v, &[1, 1, 2, 2, 0]);

pub fn array_windows(&self) -> ArrayWindows<'_, T, N>

🔬This is a nightly-only experimental API. (array_windows)

Returns an iterator over overlapping windows of N elements of a slice, starting at the beginning of the slice.

This is the const generic equivalent of windows.

If N is greater than the size of the slice, it will return no windows.

Panics

Panics if N is 0. This check will most probably get changed to a compile time error before this method gets stabilized.

Examples
#![feature(array_windows)]
let slice = [0, 1, 2, 3];
let mut iter = slice.array_windows();
assert_eq!(iter.next().unwrap(), &[0, 1]);
assert_eq!(iter.next().unwrap(), &[1, 2]);
assert_eq!(iter.next().unwrap(), &[2, 3]);
assert!(iter.next().is_none());

1.31.0 ·

pub fn rchunks(&self, chunk_size: usize) -> RChunks<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See rchunks_exact for a variant of this iterator that returns chunks of always exactly chunk_size elements, and chunks for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert_eq!(iter.next().unwrap(), &['l']);
assert!(iter.next().is_none());

1.31.0 ·

pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last chunk will not have length chunk_size.

See rchunks_exact_mut for a variant of this iterator that returns chunks of always exactly chunk_size elements, and chunks_mut for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.rchunks_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[3, 2, 2, 1, 1]);

1.31.0 ·

pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are slices and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of rchunks.

See rchunks for a variant of this iterator that also returns the remainder as a smaller chunk, and chunks_exact for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let slice = ['l', 'o', 'r', 'e', 'm'];
let mut iter = slice.rchunks_exact(2);
assert_eq!(iter.next().unwrap(), &['e', 'm']);
assert_eq!(iter.next().unwrap(), &['o', 'r']);
assert!(iter.next().is_none());
assert_eq!(iter.remainder(), &['l']);

1.31.0 ·

pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, T>

Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice.

The chunks are mutable slices, and do not overlap. If chunk_size does not divide the length of the slice, then the last up to chunk_size-1 elements will be omitted and can be retrieved from the into_remainder function of the iterator.

Due to each chunk having exactly chunk_size elements, the compiler can often optimize the resulting code better than in the case of chunks_mut.

See rchunks_mut for a variant of this iterator that also returns the remainder as a smaller chunk, and chunks_exact_mut for the same iterator but starting at the beginning of the slice.

Panics

Panics if chunk_size is 0.

Examples
let v = &mut [0, 0, 0, 0, 0];
let mut count = 1;

for chunk in v.rchunks_exact_mut(2) {
    for elem in chunk.iter_mut() {
        *elem += count;
    }
    count += 1;
}
assert_eq!(v, &[0, 2, 2, 1, 1]);

1.77.0 ·

pub fn chunk_by(&self, pred: F) -> ChunkBy<'_, T, F>where F: FnMut(&T, &T) -> bool,

Returns an iterator over the slice producing non-overlapping runs of elements using the predicate to separate them.

The predicate is called for every pair of consecutive elements, meaning that it is called on slice[0] and slice[1], followed by slice[1] and slice[2], and so on.

Examples
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];

let mut iter = slice.chunk_by(|a, b| a == b);

assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);

This method can be used to extract the sorted subslices:

let slice = &[1, 1, 2, 3, 2, 3, 2, 3, 4];

let mut iter = slice.chunk_by(|a, b| a <= b);

assert_eq!(iter.next(), Some(&[1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3][..]));
assert_eq!(iter.next(), Some(&[2, 3, 4][..]));
assert_eq!(iter.next(), None);

1.77.0 ·

pub fn chunk_by_mut(&mut self, pred: F) -> ChunkByMut<'_, T, F>where F: FnMut(&T, &T) -> bool,

Returns an iterator over the slice producing non-overlapping mutable runs of elements using the predicate to separate them.

The predicate is called for every pair of consecutive elements, meaning that it is called on slice[0] and slice[1], followed by slice[1] and slice[2], and so on.

Examples
let slice = &mut [1, 1, 1, 3, 3, 2, 2, 2];

let mut iter = slice.chunk_by_mut(|a, b| a == b);

assert_eq!(iter.next(), Some(&mut [1, 1, 1][..]));
assert_eq!(iter.next(), Some(&mut [3, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 2, 2][..]));
assert_eq!(iter.next(), None);

This method can be used to extract the sorted subslices:

let slice = &mut [1, 1, 2, 3, 2, 3, 2, 3, 4];

let mut iter = slice.chunk_by_mut(|a, b| a <= b);

assert_eq!(iter.next(), Some(&mut [1, 1, 2, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 3][..]));
assert_eq!(iter.next(), Some(&mut [2, 3, 4][..]));
assert_eq!(iter.next(), None);

1.0.0 ·

pub fn split_at(&self, mid: usize) -> (&[T], &[T])

Divides one slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Panics

Panics if mid > len. For a non-panicking alternative see split_at_checked.

Examples
let v = [1, 2, 3, 4, 5, 6];

{
   let (left, right) = v.split_at(0);
   assert_eq!(left, []);
   assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}

{
    let (left, right) = v.split_at(2);
    assert_eq!(left, [1, 2]);
    assert_eq!(right, [3, 4, 5, 6]);
}

{
    let (left, right) = v.split_at(6);
    assert_eq!(left, [1, 2, 3, 4, 5, 6]);
    assert_eq!(right, []);
}

1.0.0 ·

pub fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T])

Divides one mutable slice into two at an index.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Panics

Panics if mid > len. For a non-panicking alternative see split_at_mut_checked.

Examples
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_at_mut(2);
assert_eq!(left, [1, 0]);
assert_eq!(right, [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

1.79.0 ·

pub unsafe fn split_at_unchecked(&self, mid: usize) -> (&[T], &[T])

Divides one slice into two at an index, without doing bounds checking.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

For a safe alternative see split_at.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used. The caller has to ensure that 0 <= mid <= self.len().

Examples
let v = [1, 2, 3, 4, 5, 6];

unsafe {
   let (left, right) = v.split_at_unchecked(0);
   assert_eq!(left, []);
   assert_eq!(right, [1, 2, 3, 4, 5, 6]);
}

unsafe {
    let (left, right) = v.split_at_unchecked(2);
    assert_eq!(left, [1, 2]);
    assert_eq!(right, [3, 4, 5, 6]);
}

unsafe {
    let (left, right) = v.split_at_unchecked(6);
    assert_eq!(left, [1, 2, 3, 4, 5, 6]);
    assert_eq!(right, []);
}

1.79.0 ·

pub unsafe fn split_at_mut_unchecked( &mut self, mid: usize, ) -> (&mut [T], &mut [T])

Divides one mutable slice into two at an index, without doing bounds checking.

The first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

For a safe alternative see split_at_mut.

Safety

Calling this method with an out-of-bounds index is _undefined behavior_even if the resulting reference is not used. The caller has to ensure that 0 <= mid <= self.len().

Examples
let mut v = [1, 0, 3, 0, 5, 6];
// scoped to restrict the lifetime of the borrows
unsafe {
    let (left, right) = v.split_at_mut_unchecked(2);
    assert_eq!(left, [1, 0]);
    assert_eq!(right, [3, 0, 5, 6]);
    left[1] = 2;
    right[1] = 4;
}
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

1.80.0 ·

pub fn split_at_checked(&self, mid: usize) -> Option<(&[T], &[T])>

Divides one slice into two at an index, returning None if the slice is too short.

If mid ≤ len returns a pair of slices where the first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Otherwise, if mid > len, returns None.

Examples
let v = [1, -2, 3, -4, 5, -6];

{
   let (left, right) = v.split_at_checked(0).unwrap();
   assert_eq!(left, []);
   assert_eq!(right, [1, -2, 3, -4, 5, -6]);
}

{
    let (left, right) = v.split_at_checked(2).unwrap();
    assert_eq!(left, [1, -2]);
    assert_eq!(right, [3, -4, 5, -6]);
}

{
    let (left, right) = v.split_at_checked(6).unwrap();
    assert_eq!(left, [1, -2, 3, -4, 5, -6]);
    assert_eq!(right, []);
}

assert_eq!(None, v.split_at_checked(7));

1.80.0 ·

pub fn split_at_mut_checked( &mut self, mid: usize, ) -> Option<(&mut [T], &mut [T])>

Divides one mutable slice into two at an index, returning None if the slice is too short.

If mid ≤ len returns a pair of slices where the first will contain all indices from [0, mid) (excluding the index mid itself) and the second will contain all indices from [mid, len) (excluding the index len itself).

Otherwise, if mid > len, returns None.

Examples
let mut v = [1, 0, 3, 0, 5, 6];

if let Some((left, right)) = v.split_at_mut_checked(2) {
    assert_eq!(left, [1, 0]);
    assert_eq!(right, [3, 0, 5, 6]);
    left[1] = 2;
    right[1] = 4;
}
assert_eq!(v, [1, 2, 3, 4, 5, 6]);

assert_eq!(None, v.split_at_mut_checked(7));

1.0.0 ·

pub fn split(&self, pred: F) -> Split<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred. The matched element is not contained in the subslices.

Examples
let slice = [10, 40, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());

If the first element is matched, an empty slice will be the first item returned by the iterator. Similarly, if the last element in the slice is matched, an empty slice will be the last item returned by the iterator:

let slice = [10, 40, 33];
let mut iter = slice.split(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10, 40]);
assert_eq!(iter.next().unwrap(), &[]);
assert!(iter.next().is_none());

If two matched elements are directly adjacent, an empty slice will be present between them:

let slice = [10, 6, 33, 20];
let mut iter = slice.split(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10]);
assert_eq!(iter.next().unwrap(), &[]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());

1.0.0 ·

pub fn split_mut(&mut self, pred: F) -> SplitMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred. The matched element is not contained in the subslices.

Examples
let mut v = [10, 40, 30, 20, 60, 50];

for group in v.split_mut(|num| *num % 3 == 0) {
    group[0] = 1;
}
assert_eq!(v, [1, 40, 30, 1, 60, 1]);

1.51.0 ·

pub fn split_inclusive(&self, pred: F) -> SplitInclusive<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred. The matched element is contained in the end of the previous subslice as a terminator.

Examples
let slice = [10, 40, 33, 20];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert_eq!(iter.next().unwrap(), &[20]);
assert!(iter.next().is_none());

If the last element of the slice is matched, that element will be considered the terminator of the preceding slice. That slice will be the last item returned by the iterator.

let slice = [3, 10, 40, 33];
let mut iter = slice.split_inclusive(|num| num % 3 == 0);

assert_eq!(iter.next().unwrap(), &[3]);
assert_eq!(iter.next().unwrap(), &[10, 40, 33]);
assert!(iter.next().is_none());

1.51.0 ·

pub fn split_inclusive_mut(&mut self, pred: F) -> SplitInclusiveMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred. The matched element is contained in the previous subslice as a terminator.

Examples
let mut v = [10, 40, 30, 20, 60, 50];

for group in v.split_inclusive_mut(|num| *num % 3 == 0) {
    let terminator_idx = group.len()-1;
    group[terminator_idx] = 1;
}
assert_eq!(v, [10, 40, 1, 20, 1, 1]);

1.27.0 ·

pub fn rsplit(&self, pred: F) -> RSplit<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.

Examples
let slice = [11, 22, 33, 0, 44, 55];
let mut iter = slice.rsplit(|num| *num == 0);

assert_eq!(iter.next().unwrap(), &[44, 55]);
assert_eq!(iter.next().unwrap(), &[11, 22, 33]);
assert_eq!(iter.next(), None);

As with split(), if the first or last element is matched, an empty slice will be the first (or last) item returned by the iterator.

let v = &[0, 1, 1, 2, 3, 5, 8];
let mut it = v.rsplit(|n| *n % 2 == 0);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next().unwrap(), &[3, 5]);
assert_eq!(it.next().unwrap(), &[1, 1]);
assert_eq!(it.next().unwrap(), &[]);
assert_eq!(it.next(), None);

1.27.0 ·

pub fn rsplit_mut(&mut self, pred: F) -> RSplitMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred, starting at the end of the slice and working backwards. The matched element is not contained in the subslices.

Examples
let mut v = [100, 400, 300, 200, 600, 500];

let mut count = 0;
for group in v.rsplit_mut(|num| *num % 3 == 0) {
    count += 1;
    group[0] = count;
}
assert_eq!(v, [3, 400, 300, 2, 600, 1]);

1.0.0 ·

pub fn splitn(&self, n: usize, pred: F) -> SplitN<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples

Print the slice split once by numbers divisible by 3 (i.e., [10, 40], [20, 60, 50]):

let v = [10, 40, 30, 20, 60, 50];

for group in v.splitn(2, |num| *num % 3 == 0) {
    println!("{group:?}");
}

1.0.0 ·

pub fn splitn_mut(&mut self, n: usize, pred: F) -> SplitNMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over mutable subslices separated by elements that match pred, limited to returning at most n items. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples
let mut v = [10, 40, 30, 20, 60, 50];

for group in v.splitn_mut(2, |num| *num % 3 == 0) {
    group[0] = 1;
}
assert_eq!(v, [1, 40, 30, 1, 60, 50]);

1.0.0 ·

pub fn rsplitn(&self, n: usize, pred: F) -> RSplitN<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples

Print the slice split once, starting from the end, by numbers divisible by 3 (i.e., [50], [10, 40, 30, 20]):

let v = [10, 40, 30, 20, 60, 50];

for group in v.rsplitn(2, |num| *num % 3 == 0) {
    println!("{group:?}");
}

1.0.0 ·

pub fn rsplitn_mut(&mut self, n: usize, pred: F) -> RSplitNMut<'_, T, F>where F: FnMut(&T) -> bool,

Returns an iterator over subslices separated by elements that match pred limited to returning at most n items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices.

The last element returned, if any, will contain the remainder of the slice.

Examples
let mut s = [10, 40, 30, 20, 60, 50];

for group in s.rsplitn_mut(2, |num| *num % 3 == 0) {
    group[0] = 1;
}
assert_eq!(s, [1, 40, 30, 20, 60, 1]);

pub fn split_once(&self, pred: F) -> Option<(&[T], &[T])>where F: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (slice_split_once)

Splits the slice on the first element that matches the specified predicate.

If any matching elements are present in the slice, returns the prefix before the match and suffix after. The matching element itself is not included. If no elements match, returns None.

Examples
#![feature(slice_split_once)]
let s = [1, 2, 3, 2, 4];
assert_eq!(s.split_once(|&x| x == 2), Some((
    &[1][..],
    &[3, 2, 4][..]
)));
assert_eq!(s.split_once(|&x| x == 0), None);

pub fn rsplit_once(&self, pred: F) -> Option<(&[T], &[T])>where F: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (slice_split_once)

Splits the slice on the last element that matches the specified predicate.

If any matching elements are present in the slice, returns the prefix before the match and suffix after. The matching element itself is not included. If no elements match, returns None.

Examples
#![feature(slice_split_once)]
let s = [1, 2, 3, 2, 4];
assert_eq!(s.rsplit_once(|&x| x == 2), Some((
    &[1, 2, 3][..],
    &[4][..]
)));
assert_eq!(s.rsplit_once(|&x| x == 0), None);

1.0.0 ·

pub fn contains(&self, x: &T) -> boolwhere T: PartialEq,

Returns true if the slice contains an element with the given value.

This operation is O( n).

Note that if you have a sorted slice, binary_search may be faster.

Examples
let v = [10, 40, 30];
assert!(v.contains(&30));
assert!(!v.contains(&50));

If you do not have a &T, but some other value that you can compare with one (for example, String implements PartialEq<str>), you can use iter().any:

let v = [String::from("hello"), String::from("world")]; // slice of `String`
assert!(v.iter().any(|e| e == "hello")); // search with `&str`
assert!(!v.iter().any(|e| e == "hi"));

1.0.0 ·

pub fn starts_with(&self, needle: &[T]) -> boolwhere T: PartialEq,

Returns true if needle is a prefix of the slice or equal to the slice.

Examples
let v = [10, 40, 30];
assert!(v.starts_with(&[10]));
assert!(v.starts_with(&[10, 40]));
assert!(v.starts_with(&v));
assert!(!v.starts_with(&[50]));
assert!(!v.starts_with(&[10, 50]));

Always returns true if needle is an empty slice:

let v = &[10, 40, 30];
assert!(v.starts_with(&[]));
let v: &[u8] = &[];
assert!(v.starts_with(&[]));

1.0.0 ·

pub fn ends_with(&self, needle: &[T]) -> boolwhere T: PartialEq,

Returns true if needle is a suffix of the slice or equal to the slice.

Examples
let v = [10, 40, 30];
assert!(v.ends_with(&[30]));
assert!(v.ends_with(&[40, 30]));
assert!(v.ends_with(&v));
assert!(!v.ends_with(&[50]));
assert!(!v.ends_with(&[50, 30]));

Always returns true if needle is an empty slice:

let v = &[10, 40, 30];
assert!(v.ends_with(&[]));
let v: &[u8] = &[];
assert!(v.ends_with(&[]));

1.51.0 ·

pub fn strip_prefix

(&self, prefix: &P) -> Option<&[T]>where P: SlicePattern<Item = T> + ?Sized, T: PartialEq,

Returns a subslice with the prefix removed.

If the slice starts with prefix, returns the subslice after the prefix, wrapped in Some. If prefix is empty, simply returns the original slice. If prefix is equal to the original slice, returns an empty slice.

If the slice does not start with prefix, returns None.

Examples
let v = &[10, 40, 30];
assert_eq!(v.strip_prefix(&[10]), Some(&[40, 30][..]));
assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..]));
assert_eq!(v.strip_prefix(&[10, 40, 30]), Some(&[][..]));
assert_eq!(v.strip_prefix(&[50]), None);
assert_eq!(v.strip_prefix(&[10, 50]), None);

let prefix : &str = "he";
assert_eq!(b"hello".strip_prefix(prefix.as_bytes()),
           Some(b"llo".as_ref()));

1.51.0 ·

pub fn strip_suffix

(&self, suffix: &P) -> Option<&[T]>where P: SlicePattern<Item = T> + ?Sized, T: PartialEq,

Returns a subslice with the suffix removed.

If the slice ends with suffix, returns the subslice before the suffix, wrapped in Some. If suffix is empty, simply returns the original slice. If suffix is equal to the original slice, returns an empty slice.

If the slice does not end with suffix, returns None.

Examples
let v = &[10, 40, 30];
assert_eq!(v.strip_suffix(&[30]), Some(&[10, 40][..]));
assert_eq!(v.strip_suffix(&[40, 30]), Some(&[10][..]));
assert_eq!(v.strip_suffix(&[10, 40, 30]), Some(&[][..]));
assert_eq!(v.strip_suffix(&[50]), None);
assert_eq!(v.strip_suffix(&[50, 30]), None);

1.0.0 ·

pub fn binary_search(&self, x: &T) -> Result<usize, usize>where T: Ord,

Binary searches this slice for a given element. If the slice is not sorted, the returned result is unspecified and meaningless.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

See also binary_search_by, binary_search_by_key, and partition_point.

Examples

Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in [1, 4].

let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

assert_eq!(s.binary_search(&13),  Ok(9));
assert_eq!(s.binary_search(&4),   Err(7));
assert_eq!(s.binary_search(&100), Err(13));
let r = s.binary_search(&1);
assert!(match r { Ok(1..=4) => true, _ => false, });

If you want to find that whole range of matching items, rather than an arbitrary matching one, that can be done using partition_point:

let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

let low = s.partition_point(|x| x < &1);
assert_eq!(low, 1);
let high = s.partition_point(|x| x <= &1);
assert_eq!(high, 5);
let r = s.binary_search(&1);
assert!((low..high).contains(&r.unwrap()));

assert!(s[..low].iter().all(|&x| x < 1));
assert!(s[low..high].iter().all(|&x| x == 1));
assert!(s[high..].iter().all(|&x| x > 1));

// For something not found, the "range" of equal items is empty
assert_eq!(s.partition_point(|x| x < &11), 9);
assert_eq!(s.partition_point(|x| x <= &11), 9);
assert_eq!(s.binary_search(&11), Err(9));

If you want to insert an item to a sorted vector, while maintaining sort order, consider using partition_point:

let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x <= num);
// If `num` is unique, `s.partition_point(|&x| x < num)` (with `<`) is equivalent to
// `s.binary_search(&num).unwrap_or_else(|x| x)`, but using `<=` will allow `insert`
// to shift less elements.
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);

1.0.0 ·

pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>where F: FnMut(&'a T) -> Ordering,

Binary searches this slice with a comparator function.

The comparator function should return an order code that indicates whether its argument is Less, Equal or Greater the desired target. If the slice is not sorted or if the comparator function does not implement an order consistent with the sort order of the underlying slice, the returned result is unspecified and meaningless.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

See also binary_search, binary_search_by_key, and partition_point.

Examples

Looks up a series of four elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in [1, 4].

let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];

let seek = 13;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Ok(9));
let seek = 4;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(7));
let seek = 100;
assert_eq!(s.binary_search_by(|probe| probe.cmp(&seek)), Err(13));
let seek = 1;
let r = s.binary_search_by(|probe| probe.cmp(&seek));
assert!(match r { Ok(1..=4) => true, _ => false, });

1.10.0 ·

pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<usize, usize>where F: FnMut(&'a T) -> B, B: Ord,

Binary searches this slice with a key extraction function.

Assumes that the slice is sorted by the key, for instance with sort_by_key using the same key extraction function. If the slice is not sorted by the key, the returned result is unspecified and meaningless.

If the value is found then Result::Ok is returned, containing the index of the matching element. If there are multiple matches, then any one of the matches could be returned. The index is chosen deterministically, but is subject to change in future versions of Rust. If the value is not found then Result::Err is returned, containing the index where a matching element could be inserted while maintaining sorted order.

See also binary_search, binary_search_by, and partition_point.

Examples

Looks up a series of four elements in a slice of pairs sorted by their second elements. The first is found, with a uniquely determined position; the second and third are not found; the fourth could match any position in [1, 4].

let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1),
         (1, 2), (2, 3), (4, 5), (5, 8), (3, 13),
         (1, 21), (2, 34), (4, 55)];

assert_eq!(s.binary_search_by_key(&13, |&(a, b)| b),  Ok(9));
assert_eq!(s.binary_search_by_key(&4, |&(a, b)| b),   Err(7));
assert_eq!(s.binary_search_by_key(&100, |&(a, b)| b), Err(13));
let r = s.binary_search_by_key(&1, |&(a, b)| b);
assert!(match r { Ok(1..=4) => true, _ => false, });

1.20.0 ·

pub fn sort_unstable(&mut self)where T: Ord,

Sorts the slice without preserving the initial order of equal elements.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O( n * log( n)) worst-case.

If the implementation of Ord for T does not implement a total order the resulting order of elements in the slice is unspecified. All original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. Same is true if the implementation of Ord for T panics.

Sorting types that only implement PartialOrd such as f32 and f64 require additional precautions. For example, f32::NAN != f32::NAN, which doesn’t fulfill the reflexivity requirement of Ord. By using an alternative comparison function with slice::sort_unstable_by such as f32::total_cmp or f64::total_cmp that defines a total order users can sort slices containing floating-point values. Alternatively, if all values in the slice are guaranteed to be in a subset for which PartialOrd::partial_cmpforms a total order, it’s possible to sort the slice with sort_unstable_by(|a, b| a.partial_cmp(b).unwrap()).

Current implementation

The current implementation is based on ipnsort by Lukas Bergdoll and Orson Peters, which combines the fast average case of quicksort with the fast worst case of heapsort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

It is typically faster than stable sorting, except in a few special cases, e.g., when the slice is partially sorted.

Panics

May panic if the implementation of Ord for T does not implement a total order.

Examples
let mut v = [4, -5, 1, -3, 2];

v.sort_unstable();
assert_eq!(v, [-5, -3, 1, 2, 4]);

1.20.0 ·

pub fn sort_unstable_by(&mut self, compare: F)where F: FnMut(&T, &T) -> Ordering,

Sorts the slice with a comparison function, without preserving the initial order of equal elements.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O( n * log( n)) worst-case.

If the comparison function compare does not implement a total order the resulting order of elements in the slice is unspecified. All original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. Same is true if compare panics.

For example |a, b| (a - b).cmp(a) is a comparison function that is neither transitive nor reflexive nor total, a < b < c < a with a = 1, b = 2, c = 3. For more information and examples see the Ord documentation.

Current implementation

The current implementation is based on ipnsort by Lukas Bergdoll and Orson Peters, which combines the fast average case of quicksort with the fast worst case of heapsort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

It is typically faster than stable sorting, except in a few special cases, e.g., when the slice is partially sorted.

Panics

May panic if compare does not implement a total order.

Examples
let mut v = [4, -5, 1, -3, 2];
v.sort_unstable_by(|a, b| a.cmp(b));
assert_eq!(v, [-5, -3, 1, 2, 4]);

// reverse sorting
v.sort_unstable_by(|a, b| b.cmp(a));
assert_eq!(v, [4, 2, 1, -3, -5]);

1.20.0 ·

pub fn sort_unstable_by_key<K, F>(&mut self, f: F)where F: FnMut(&T) -> K, K: Ord,

Sorts the slice with a key extraction function, without preserving the initial order of equal elements.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O( n * log( n)) worst-case.

If the implementation of Ord for K does not implement a total order the resulting order of elements in the slice is unspecified. All original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. Same is true if the implementation of Ord for K panics.

Current implementation

The current implementation is based on ipnsort by Lukas Bergdoll and Orson Peters, which combines the fast average case of quicksort with the fast worst case of heapsort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

It is typically faster than stable sorting, except in a few special cases, e.g., when the slice is partially sorted.

Panics

May panic if the implementation of Ord for K does not implement a total order.

Examples
let mut v = [4i32, -5, 1, -3, 2];

v.sort_unstable_by_key(|k| k.abs());
assert_eq!(v, [1, 2, -3, 4, -5]);

1.49.0 ·

pub fn select_nth_unstable( &mut self, index: usize, ) -> (&mut [T], &mut T, &mut [T])where T: Ord,

Reorders the slice such that the element at index after the reordering is at its final sorted position.

This reordering has the additional property that any value at position i < index will be less than or equal to any value at a position j > index. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position index), in-place (i.e. does not allocate), and runs in O( n) time. This function is also known as “kth element” in other libraries.

It returns a triplet of the following from the reordered slice: the subslice prior to index, the element at index, and the subslice after index; accordingly, the values in those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to the value of the element at index.

Current implementation

The current algorithm is an introselect implementation based on ipnsort by Lukas Bergdoll and Orson Peters, which is also the basis for sort_unstable. The fallback algorithm is Median of Medians using Tukey’s Ninther for pivot selection, which guarantees linear runtime for all inputs.

Panics

Panics when index >= len(), meaning it always panics on empty slices.

May panic if the implementation of Ord for T does not implement a total order.

Examples
let mut v = [-5i32, 4, 2, -3, 1];

// Find the items less than or equal to the median, the median, and greater than or equal to
// the median.
let (lesser, median, greater) = v.select_nth_unstable(2);

assert!(lesser == [-3, -5] || lesser == [-5, -3]);
assert_eq!(median, &mut 1);
assert!(greater == [4, 2] || greater == [2, 4]);

// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [-3, -5, 1, 2, 4] ||
        v == [-5, -3, 1, 2, 4] ||
        v == [-3, -5, 1, 4, 2] ||
        v == [-5, -3, 1, 4, 2]);

1.49.0 ·

pub fn select_nth_unstable_by( &mut self, index: usize, compare: F, ) -> (&mut [T], &mut T, &mut [T])where F: FnMut(&T, &T) -> Ordering,

Reorders the slice with a comparator function such that the element at index after the reordering is at its final sorted position.

This reordering has the additional property that any value at position i < index will be less than or equal to any value at a position j > index using the comparator function. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position index), in-place (i.e. does not allocate), and runs in O( n) time. This function is also known as “kth element” in other libraries.

It returns a triplet of the following from the slice reordered according to the provided comparator function: the subslice prior to index, the element at index, and the subslice after index; accordingly, the values in those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to the value of the element at index.

Current implementation

The current algorithm is an introselect implementation based on ipnsort by Lukas Bergdoll and Orson Peters, which is also the basis for sort_unstable. The fallback algorithm is Median of Medians using Tukey’s Ninther for pivot selection, which guarantees linear runtime for all inputs.

Panics

Panics when index >= len(), meaning it always panics on empty slices.

May panic if compare does not implement a total order.

Examples
let mut v = [-5i32, 4, 2, -3, 1];

// Find the items less than or equal to the median, the median, and greater than or equal to
// the median as if the slice were sorted in descending order.
let (lesser, median, greater) = v.select_nth_unstable_by(2, |a, b| b.cmp(a));

assert!(lesser == [4, 2] || lesser == [2, 4]);
assert_eq!(median, &mut 1);
assert!(greater == [-3, -5] || greater == [-5, -3]);

// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [2, 4, 1, -5, -3] ||
        v == [2, 4, 1, -3, -5] ||
        v == [4, 2, 1, -5, -3] ||
        v == [4, 2, 1, -3, -5]);

1.49.0 ·

pub fn select_nth_unstable_by_key<K, F>( &mut self, index: usize, f: F, ) -> (&mut [T], &mut T, &mut [T])where F: FnMut(&T) -> K, K: Ord,

Reorders the slice with a key extraction function such that the element at index after the reordering is at its final sorted position.

This reordering has the additional property that any value at position i < index will be less than or equal to any value at a position j > index using the key extraction function. Additionally, this reordering is unstable (i.e. any number of equal elements may end up at position index), in-place (i.e. does not allocate), and runs in O( n) time. This function is also known as “kth element” in other libraries.

It returns a triplet of the following from the slice reordered according to the provided key extraction function: the subslice prior to index, the element at index, and the subslice after index; accordingly, the values in those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to the value of the element at index.

Current implementation

The current algorithm is an introselect implementation based on ipnsort by Lukas Bergdoll and Orson Peters, which is also the basis for sort_unstable. The fallback algorithm is Median of Medians using Tukey’s Ninther for pivot selection, which guarantees linear runtime for all inputs.

Panics

Panics when index >= len(), meaning it always panics on empty slices.

May panic if K: Ord does not implement a total order.

Examples
let mut v = [-5i32, 4, 1, -3, 2];

// Find the items less than or equal to the median, the median, and greater than or equal to
// the median as if the slice were sorted according to absolute value.
let (lesser, median, greater) = v.select_nth_unstable_by_key(2, |a| a.abs());

assert!(lesser == [1, 2] || lesser == [2, 1]);
assert_eq!(median, &mut -3);
assert!(greater == [4, -5] || greater == [-5, 4]);

// We are only guaranteed the slice will be one of the following, based on the way we sort
// about the specified index.
assert!(v == [1, 2, -3, 4, -5] ||
        v == [1, 2, -3, -5, 4] ||
        v == [2, 1, -3, 4, -5] ||
        v == [2, 1, -3, -5, 4]);

pub fn partition_dedup(&mut self) -> (&mut [T], &mut [T])where T: PartialEq,

🔬This is a nightly-only experimental API. (slice_partition_dedup)

Moves all consecutive repeated elements to the end of the slice according to the PartialEq trait implementation.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

If the slice is sorted, the first returned slice contains no duplicates.

Examples
#![feature(slice_partition_dedup)]

let mut slice = [1, 2, 2, 3, 3, 2, 1, 1];

let (dedup, duplicates) = slice.partition_dedup();

assert_eq!(dedup, [1, 2, 3, 2, 1]);
assert_eq!(duplicates, [2, 3, 1]);

pub fn partition_dedup_by(&mut self, same_bucket: F) -> (&mut [T], &mut [T])where F: FnMut(&mut T, &mut T) -> bool,

🔬This is a nightly-only experimental API. (slice_partition_dedup)

Moves all but the first of consecutive elements to the end of the slice satisfying a given equality relation.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

The same_bucket function is passed references to two elements from the slice and must determine if the elements compare equal. The elements are passed in opposite order from their order in the slice, so if same_bucket(a, b) returns true, a is moved at the end of the slice.

If the slice is sorted, the first returned slice contains no duplicates.

Examples
#![feature(slice_partition_dedup)]

let mut slice = ["foo", "Foo", "BAZ", "Bar", "bar", "baz", "BAZ"];

let (dedup, duplicates) = slice.partition_dedup_by(|a, b| a.eq_ignore_ascii_case(b));

assert_eq!(dedup, ["foo", "BAZ", "Bar", "baz"]);
assert_eq!(duplicates, ["bar", "Foo", "BAZ"]);

pub fn partition_dedup_by_key<K, F>(&mut self, key: F) -> (&mut [T], &mut [T])where F: FnMut(&mut T) -> K, K: PartialEq,

🔬This is a nightly-only experimental API. (slice_partition_dedup)

Moves all but the first of consecutive elements to the end of the slice that resolve to the same key.

Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order.

If the slice is sorted, the first returned slice contains no duplicates.

Examples
#![feature(slice_partition_dedup)]

let mut slice = [10, 20, 21, 30, 30, 20, 11, 13];

let (dedup, duplicates) = slice.partition_dedup_by_key(|i| *i / 10);

assert_eq!(dedup, [10, 20, 30, 20, 11]);
assert_eq!(duplicates, [21, 30, 13]);

1.26.0 ·

pub fn rotate_left(&mut self, mid: usize)

Rotates the slice in-place such that the first mid elements of the slice move to the end while the last self.len() - mid elements move to the front.

After calling rotate_left, the element previously at index mid will become the first element in the slice.

Panics

This function will panic if mid is greater than the length of the slice. Note that mid == self.len() does not panic and is a no-op rotation.

Complexity

Takes linear (in self.len()) time.

Examples
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a.rotate_left(2);
assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);

Rotating a subslice:

let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a[1..5].rotate_left(1);
assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']);

1.26.0 ·

pub fn rotate_right(&mut self, k: usize)

Rotates the slice in-place such that the first self.len() - kelements of the slice move to the end while the last k elements move to the front.

After calling rotate_right, the element previously at index self.len() - k will become the first element in the slice.

Panics

This function will panic if k is greater than the length of the slice. Note that k == self.len() does not panic and is a no-op rotation.

Complexity

Takes linear (in self.len()) time.

Examples
let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a.rotate_right(2);
assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);

Rotating a subslice:

let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
a[1..5].rotate_right(1);
assert_eq!(a, ['a', 'e', 'b', 'c', 'd', 'f']);

1.50.0 ·

pub fn fill(&mut self, value: T)where T: Clone,

Fills self with elements by cloning value.

Examples
let mut buf = vec![0; 10];
buf.fill(1);
assert_eq!(buf, vec![1; 10]);

1.51.0 ·

pub fn fill_with(&mut self, f: F)where F: FnMut() -> T,

Fills self with elements returned by calling a closure repeatedly.

This method uses a closure to create new values. If you’d rather Clone a given value, use fill. If you want to use the Defaulttrait to generate values, you can pass Default::default as the argument.

Examples
let mut buf = vec![1; 10];
buf.fill_with(Default::default);
assert_eq!(buf, vec![0; 10]);

1.7.0 ·

pub fn clone_from_slice(&mut self, src: &[T])where T: Clone,

Copies the elements from src into self.

The length of src must be the same as self.

Panics

This function will panic if the two slices have different lengths.

Examples

Cloning two elements from a slice into another:

let src = [1, 2, 3, 4];
let mut dst = [0, 0];

// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
dst.clone_from_slice(&src[2..]);

assert_eq!(src, [1, 2, 3, 4]);
assert_eq!(dst, [3, 4]);

Rust enforces that there can only be one mutable reference with no immutable references to a particular piece of data in a particular scope. Because of this, attempting to use clone_from_slice on a single slice will result in a compile failure:ⓘ

let mut slice = [1, 2, 3, 4, 5];

slice[..2].clone_from_slice(&slice[3..]); // compile fail!

To work around this, we can use split_at_mut to create two distinct sub-slices from a slice:

let mut slice = [1, 2, 3, 4, 5];

{
    let (left, right) = slice.split_at_mut(2);
    left.clone_from_slice(&right[1..]);
}

assert_eq!(slice, [4, 5, 3, 4, 5]);

1.9.0 ·

pub fn copy_from_slice(&mut self, src: &[T])where T: Copy,

Copies all elements from src into self, using a memcpy.

The length of src must be the same as self.

If T does not implement Copy, use clone_from_slice.

Panics

This function will panic if the two slices have different lengths.

Examples

Copying two elements from a slice into another:

let src = [1, 2, 3, 4];
let mut dst = [0, 0];

// Because the slices have to be the same length,
// we slice the source slice from four elements
// to two. It will panic if we don't do this.
dst.copy_from_slice(&src[2..]);

assert_eq!(src, [1, 2, 3, 4]);
assert_eq!(dst, [3, 4]);

Rust enforces that there can only be one mutable reference with no immutable references to a particular piece of data in a particular scope. Because of this, attempting to use copy_from_slice on a single slice will result in a compile failure:ⓘ

let mut slice = [1, 2, 3, 4, 5];

slice[..2].copy_from_slice(&slice[3..]); // compile fail!

To work around this, we can use split_at_mut to create two distinct sub-slices from a slice:

let mut slice = [1, 2, 3, 4, 5];

{
    let (left, right) = slice.split_at_mut(2);
    left.copy_from_slice(&right[1..]);
}

assert_eq!(slice, [4, 5, 3, 4, 5]);

1.37.0 ·

pub fn copy_within(&mut self, src: R, dest: usize)where R: RangeBounds, T: Copy,

Copies elements from one part of the slice to another part of itself, using a memmove.

src is the range within self to copy from. dest is the starting index of the range within self to copy to, which will have the same length as src. The two ranges may overlap. The ends of the two ranges must be less than or equal to self.len().

Panics

This function will panic if either range exceeds the end of the slice, or if the end of src is before the start.

Examples

Copying four bytes within a slice:

let mut bytes = *b"Hello, World!";

bytes.copy_within(1..5, 8);

assert_eq!(&bytes, b"Hello, Wello!");

1.27.0 ·

pub fn swap_with_slice(&mut self, other: &mut [T])

Swaps all elements in self with those in other.

The length of other must be the same as self.

Panics

This function will panic if the two slices have different lengths.

Example

Swapping two elements across slices:

let mut slice1 = [0, 0];
let mut slice2 = [1, 2, 3, 4];

slice1.swap_with_slice(&mut slice2[2..]);

assert_eq!(slice1, [3, 4]);
assert_eq!(slice2, [1, 2, 0, 0]);

Rust enforces that there can only be one mutable reference to a particular piece of data in a particular scope. Because of this, attempting to use swap_with_slice on a single slice will result in a compile failure:ⓘ

let mut slice = [1, 2, 3, 4, 5];
slice[..2].swap_with_slice(&mut slice[3..]); // compile fail!

To work around this, we can use split_at_mut to create two distinct mutable sub-slices from a slice:

let mut slice = [1, 2, 3, 4, 5];

{
    let (left, right) = slice.split_at_mut(2);
    left.swap_with_slice(&mut right[1..]);
}

assert_eq!(slice, [4, 5, 3, 1, 2]);

1.30.0 ·

pub unsafe fn align_to(&self) -> (&[T], &[U], &[T])

Transmutes the slice to a slice of another type, ensuring alignment of the types is maintained.

This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The middle part will be as big as possible under the given alignment constraint and element size.

This method has no purpose when either input element T or output element U are zero-sized and will return the original slice without splitting anything.

Safety

This method is essentially a transmute with respect to the elements in the returned middle slice, so all the usual caveats pertaining to transmute::<T, U> also apply here.

Examples

Basic usage:

unsafe {
    let bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
    let (prefix, shorts, suffix) = bytes.align_to::<u16>();
    // less_efficient_algorithm_for_bytes(prefix);
    // more_efficient_algorithm_for_aligned_shorts(shorts);
    // less_efficient_algorithm_for_bytes(suffix);
}

1.30.0 ·

pub unsafe fn align_to_mut(&mut self) -> (&mut [T], &mut [U], &mut [T])

Transmutes the mutable slice to a mutable slice of another type, ensuring alignment of the types is maintained.

This method splits the slice into three distinct slices: prefix, correctly aligned middle slice of a new type, and the suffix slice. The middle part will be as big as possible under the given alignment constraint and element size.

This method has no purpose when either input element T or output element U are zero-sized and will return the original slice without splitting anything.

Safety

This method is essentially a transmute with respect to the elements in the returned middle slice, so all the usual caveats pertaining to transmute::<T, U> also apply here.

Examples

Basic usage:

unsafe {
    let mut bytes: [u8; 7] = [1, 2, 3, 4, 5, 6, 7];
    let (prefix, shorts, suffix) = bytes.align_to_mut::<u16>();
    // less_efficient_algorithm_for_bytes(prefix);
    // more_efficient_algorithm_for_aligned_shorts(shorts);
    // less_efficient_algorithm_for_bytes(suffix);
}

pub fn as_simd(&self) -> (&[T], &[Simd<T, LANES>], &[T])where Simd<T, LANES>: AsRef<[T; LANES]>, T: SimdElement, LaneCount: SupportedLaneCount,

🔬This is a nightly-only experimental API. (portable_simd)

Splits a slice into a prefix, a middle of aligned SIMD types, and a suffix.

This is a safe wrapper around slice::align_to, so inherits the same guarantees as that method.

Panics

This will panic if the size of the SIMD type is different from LANES times that of the scalar.

At the time of writing, the trait restrictions on Simd<T, LANES> keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like LANES == 3.

Examples
#![feature(portable_simd)]
use core::simd::prelude::*;

let short = &[1, 2, 3];
let (prefix, middle, suffix) = short.as_simd::<4>();
assert_eq!(middle, []); // Not enough elements for anything in the middle

// They might be split in any possible way between prefix and suffix
let it = prefix.iter().chain(suffix).copied();
assert_eq!(it.collect::<Vec<_>>(), vec![1, 2, 3]);

fn basic_simd_sum(x: &[f32]) -> f32 {
    use std::ops::Add;
    let (prefix, middle, suffix) = x.as_simd();
    let sums = f32x4::from_array([
        prefix.iter().copied().sum(),
        0.0,
        0.0,
        suffix.iter().copied().sum(),
    ]);
    let sums = middle.iter().copied().fold(sums, f32x4::add);
    sums.reduce_sum()
}

let numbers: Vec<f32> = (1..101).map(|x| x as _).collect();
assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0);

pub fn as_simd_mut( &mut self, ) -> (&mut [T], &mut [Simd<T, LANES>], &mut [T])where Simd<T, LANES>: AsMut<[T; LANES]>, T: SimdElement, LaneCount: SupportedLaneCount,

🔬This is a nightly-only experimental API. (portable_simd)

Splits a mutable slice into a mutable prefix, a middle of aligned SIMD types, and a mutable suffix.

This is a safe wrapper around slice::align_to_mut, so inherits the same guarantees as that method.

This is the mutable version of slice::as_simd; see that for examples.

Panics

This will panic if the size of the SIMD type is different from LANES times that of the scalar.

At the time of writing, the trait restrictions on Simd<T, LANES> keeps that from ever happening, as only power-of-two numbers of lanes are supported. It’s possible that, in the future, those restrictions might be lifted in a way that would make it possible to see panics from this method for something like LANES == 3.1.82.0 ·

pub fn is_sorted(&self) -> boolwhere T: PartialOrd,

Checks if the elements of this slice are sorted.

That is, for each element a and its following element b, a <= b must hold. If the slice yields exactly zero or one element, true is returned.

Note that if Self::Item is only PartialOrd, but not Ord, the above definition implies that this function returns false if any two consecutive items are not comparable.

Examples
let empty: [i32; 0] = [];

assert!([1, 2, 2, 9].is_sorted());
assert!(![1, 3, 2, 4].is_sorted());
assert!([0].is_sorted());
assert!(empty.is_sorted());
assert!(![0.0, 1.0, f32::NAN].is_sorted());

1.82.0 ·

pub fn is_sorted_by<'a, F>(&'a self, compare: F) -> boolwhere F: FnMut(&'a T, &'a T) -> bool,

Checks if the elements of this slice are sorted using the given comparator function.

Instead of using PartialOrd::partial_cmp, this function uses the given comparefunction to determine whether two elements are to be considered in sorted order.

Examples
assert!([1, 2, 2, 9].is_sorted_by(|a, b| a <= b));
assert!(![1, 2, 2, 9].is_sorted_by(|a, b| a < b));

assert!([0].is_sorted_by(|a, b| true));
assert!([0].is_sorted_by(|a, b| false));

let empty: [i32; 0] = [];
assert!(empty.is_sorted_by(|a, b| false));
assert!(empty.is_sorted_by(|a, b| true));

1.82.0 ·

pub fn is_sorted_by_key<'a, F, K>(&'a self, f: F) -> boolwhere F: FnMut(&'a T) -> K, K: PartialOrd,

Checks if the elements of this slice are sorted using the given key extraction function.

Instead of comparing the slice’s elements directly, this function compares the keys of the elements, as determined by f. Apart from that, it’s equivalent to is_sorted; see its documentation for more information.

Examples
assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs()));

1.52.0 ·

pub fn partition_point

(&self, pred: P) -> usizewhere P: FnMut(&T) -> bool,

Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).

The slice is assumed to be partitioned according to the given predicate. This means that all elements for which the predicate returns true are at the start of the slice and all elements for which the predicate returns false are at the end. For example, [7, 15, 3, 5, 4, 12, 6] is partitioned under the predicate x % 2 != 0(all odd numbers are at the start, all even at the end).

If this slice is not partitioned, the returned result is unspecified and meaningless, as this method performs a kind of binary search.

See also binary_search, binary_search_by, and binary_search_by_key.

Examples
let v = [1, 2, 3, 3, 5, 6, 7];
let i = v.partition_point(|&x| x < 5);

assert_eq!(i, 4);
assert!(v[..i].iter().all(|&x| x < 5));
assert!(v[i..].iter().all(|&x| !(x < 5)));

If all elements of the slice match the predicate, including if the slice is empty, then the length of the slice will be returned:

let a = [2, 4, 8];
assert_eq!(a.partition_point(|x| x < &100), a.len());
let a: [i32; 0] = [];
assert_eq!(a.partition_point(|x| x < &100), 0);

If you want to insert an item to a sorted vector, while maintaining sort order:

let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
let num = 42;
let idx = s.partition_point(|&x| x <= num);
s.insert(idx, num);
assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);

pub fn take<'a, R>(self: &mut &'a [T], range: R) -> Option<&'a [T]>where R: OneSidedRange,

🔬This is a nightly-only experimental API. (slice_take)

Removes the subslice corresponding to the given range and returns a reference to it.

Returns None and does not modify the slice if the given range is out of bounds.

Note that this method only accepts one-sided ranges such as 2.. or ..6, but not 2..6.

Examples

Taking the first three elements of a slice:

#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c', 'd'];
let mut first_three = slice.take(..3).unwrap();

assert_eq!(slice, &['d']);
assert_eq!(first_three, &['a', 'b', 'c']);

Taking the last two elements of a slice:

#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c', 'd'];
let mut tail = slice.take(2..).unwrap();

assert_eq!(slice, &['a', 'b']);
assert_eq!(tail, &['c', 'd']);

Getting None when range is out of bounds:

#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c', 'd'];

assert_eq!(None, slice.take(5..));
assert_eq!(None, slice.take(..5));
assert_eq!(None, slice.take(..=4));
let expected: &[char] = &['a', 'b', 'c', 'd'];
assert_eq!(Some(expected), slice.take(..4));

pub fn take_mut<'a, R>(self: &mut &'a mut [T], range: R) -> Option<&'a mut [T]>where R: OneSidedRange,

🔬This is a nightly-only experimental API. (slice_take)

Removes the subslice corresponding to the given range and returns a mutable reference to it.

Returns None and does not modify the slice if the given range is out of bounds.

Note that this method only accepts one-sided ranges such as 2.. or ..6, but not 2..6.

Examples

Taking the first three elements of a slice:

#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
let mut first_three = slice.take_mut(..3).unwrap();

assert_eq!(slice, &mut ['d']);
assert_eq!(first_three, &mut ['a', 'b', 'c']);

Taking the last two elements of a slice:

#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];
let mut tail = slice.take_mut(2..).unwrap();

assert_eq!(slice, &mut ['a', 'b']);
assert_eq!(tail, &mut ['c', 'd']);

Getting None when range is out of bounds:

#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c', 'd'];

assert_eq!(None, slice.take_mut(5..));
assert_eq!(None, slice.take_mut(..5));
assert_eq!(None, slice.take_mut(..=4));
let expected: &mut [_] = &mut ['a', 'b', 'c', 'd'];
assert_eq!(Some(expected), slice.take_mut(..4));

pub fn take_first<'a>(self: &mut &'a [T]) -> Option<&'a T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the first element of the slice and returns a reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c'];
let first = slice.take_first().unwrap();

assert_eq!(slice, &['b', 'c']);
assert_eq!(first, &'a');

pub fn take_first_mut<'a>(self: &mut &'a mut [T]) -> Option<&'a mut T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the first element of the slice and returns a mutable reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c'];
let first = slice.take_first_mut().unwrap();
*first = 'd';

assert_eq!(slice, &['b', 'c']);
assert_eq!(first, &'d');

pub fn take_last<'a>(self: &mut &'a [T]) -> Option<&'a T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the last element of the slice and returns a reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &[_] = &['a', 'b', 'c'];
let last = slice.take_last().unwrap();

assert_eq!(slice, &['a', 'b']);
assert_eq!(last, &'c');

pub fn take_last_mut<'a>(self: &mut &'a mut [T]) -> Option<&'a mut T>

🔬This is a nightly-only experimental API. (slice_take)

Removes the last element of the slice and returns a mutable reference to it.

Returns None if the slice is empty.

Examples
#![feature(slice_take)]

let mut slice: &mut [_] = &mut ['a', 'b', 'c'];
let last = slice.take_last_mut().unwrap();
*last = 'd';

assert_eq!(slice, &['a', 'b']);
assert_eq!(last, &'d');

pub unsafe fn get_many_unchecked_mut( &mut self, indices: [usize; N], ) -> [&mut T; N]

🔬This is a nightly-only experimental API. (get_many_mut)

Returns mutable references to many indices at once, without doing any checks.

For a safe alternative see get_many_mut.

Safety

Calling this method with overlapping or out-of-bounds indices is _undefined behavior_even if the resulting references are not used.

Examples
#![feature(get_many_mut)]

let x = &mut [1, 2, 4];

unsafe {
    let [a, b] = x.get_many_unchecked_mut([0, 2]);
    *a *= 10;
    *b *= 100;
}
assert_eq!(x, &[10, 2, 400]);

pub fn get_many_mut( &mut self, indices: [usize; N], ) -> Result<[&mut T; N], GetManyMutError>

🔬This is a nightly-only experimental API. (get_many_mut)

Returns mutable references to many indices at once.

Returns an error if any index is out-of-bounds, or if the same index was passed more than once.

Examples
#![feature(get_many_mut)]

let v = &mut [1, 2, 3];
if let Ok([a, b]) = v.get_many_mut([0, 2]) {
    *a = 413;
    *b = 612;
}
assert_eq!(v, &[413, 2, 612]);

pub fn elem_offset(&self, element: &T) -> Option

🔬This is a nightly-only experimental API. (substr_range)

Returns the index that an element reference points to.

Returns None if element does not point within the slice or if it points between elements.

This method is useful for extending slice iterators like slice::split.

Note that this uses pointer arithmetic and does not compare elements. To find the index of an element via comparison, use .iter().position() instead.

Panics

Panics if T is zero-sized.

Examples

Basic usage:

#![feature(substr_range)]

let nums: &[u32] = &[1, 7, 1, 1];
let num = &nums[2];

assert_eq!(num, &1);
assert_eq!(nums.elem_offset(num), Some(2));

Returning None with an in-between element:

#![feature(substr_range)]

let arr: &[[u32; 2]] = &[[0, 1], [2, 3]];
let flat_arr: &[u32] = arr.as_flattened();

let ok_elm: &[u32; 2] = flat_arr[0..2].try_into().unwrap();
let weird_elm: &[u32; 2] = flat_arr[1..3].try_into().unwrap();

assert_eq!(ok_elm, &[0, 1]);
assert_eq!(weird_elm, &[1, 2]);

assert_eq!(arr.elem_offset(ok_elm), Some(0)); // Points to element 0
assert_eq!(arr.elem_offset(weird_elm), None); // Points between element 0 and 1

pub fn subslice_range(&self, subslice: &[T]) -> Option<Range>

🔬This is a nightly-only experimental API. (substr_range)

Returns the range of indices that a subslice points to.

Returns None if subslice does not point within the slice or if it points between elements.

This method does not compare elements. Instead, this method finds the location in the slice that subslice was obtained from. To find the index of a subslice via comparison, instead use .windows() .position().

This method is useful for extending slice iterators like slice::split.

Note that this may return a false positive (either Some(0..0) or Some(self.len()..self.len())) if subslice has a length of zero and points to the beginning or end of another, separate, slice.

Panics

Panics if T is zero-sized.

Examples

Basic usage:

#![feature(substr_range)]

let nums = &[0, 5, 10, 0, 0, 5];

let mut iter = nums
    .split(|t| *t == 0)
    .map(|n| nums.subslice_range(n).unwrap());

assert_eq!(iter.next(), Some(0..0));
assert_eq!(iter.next(), Some(1..3));
assert_eq!(iter.next(), Some(4..4));
assert_eq!(iter.next(), Some(5..6));

1.80.0 ·

pub fn as_flattened(&self) -> &[T]

Takes a &[[T; N]], and flattens it to a &[T].

Panics

This panics if the length of the resulting slice would overflow a usize.

This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If size_of::<T>() > 0, this will never panic.

Examples
assert_eq!([[1, 2, 3], [4, 5, 6]].as_flattened(), &[1, 2, 3, 4, 5, 6]);

assert_eq!(
    [[1, 2, 3], [4, 5, 6]].as_flattened(),
    [[1, 2], [3, 4], [5, 6]].as_flattened(),
);

let slice_of_empty_arrays: &[[i32; 0]] = &[[], [], [], [], []];
assert!(slice_of_empty_arrays.as_flattened().is_empty());

let empty_slice_of_arrays: &[[u32; 10]] = &[];
assert!(empty_slice_of_arrays.as_flattened().is_empty());

1.80.0 ·

pub fn as_flattened_mut(&mut self) -> &mut [T]

Takes a &mut [[T; N]], and flattens it to a &mut [T].

Panics

This panics if the length of the resulting slice would overflow a usize.

This is only possible when flattening a slice of arrays of zero-sized types, and thus tends to be irrelevant in practice. If size_of::<T>() > 0, this will never panic.

Examples
fn add_5_to_all(slice: &mut [i32]) {
    for i in slice {
        *i += 5;
    }
}

let mut array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
add_5_to_all(array.as_flattened_mut());
assert_eq!(array, [[6, 7, 8], [9, 10, 11], [12, 13, 14]]);

pub fn sort_floats(&mut self)

🔬This is a nightly-only experimental API. (sort_floats)

Sorts the slice of floats.

This sort is in-place (i.e. does not allocate), O( n * log( n)) worst-case, and uses the ordering defined by f32::total_cmp.

Current implementation

This uses the same sorting algorithm as sort_unstable_by.

Examples
#![feature(sort_floats)]
let mut v = [2.6, -5e-8, f32::NAN, 8.29, f32::INFINITY, -1.0, 0.0, -f32::INFINITY, -0.0];

v.sort_floats();
let sorted = [-f32::INFINITY, -1.0, -5e-8, -0.0, 0.0, 2.6, 8.29, f32::INFINITY, f32::NAN];
assert_eq!(&v[..8], &sorted[..8]);
assert!(v[8].is_nan());

pub fn sort_floats(&mut self)

🔬This is a nightly-only experimental API. (sort_floats)

Sorts the slice of floats.

This sort is in-place (i.e. does not allocate), O( n * log( n)) worst-case, and uses the ordering defined by f64::total_cmp.

Current implementation

This uses the same sorting algorithm as sort_unstable_by.

Examples
#![feature(sort_floats)]
let mut v = [2.6, -5e-8, f64::NAN, 8.29, f64::INFINITY, -1.0, 0.0, -f64::INFINITY, -0.0];

v.sort_floats();
let sorted = [-f64::INFINITY, -1.0, -5e-8, -0.0, 0.0, 2.6, 8.29, f64::INFINITY, f64::NAN];
assert_eq!(&v[..8], &sorted[..8]);
assert!(v[8].is_nan());

1.79.0 ·

pub fn utf8_chunks(&self) -> Utf8Chunks<'_>

Creates an iterator over the contiguous valid UTF-8 ranges of this slice, and the non-UTF-8 fragments in between.

See the Utf8Chunk type for documenation of the items yielded by this iterator.

Examples

This function formats arbitrary but mostly-UTF-8 bytes into Rust source code in the form of a C-string literal ( c"...").

use std::fmt::Write as _;

pub fn cstr_literal(bytes: &[u8]) -> String {
    let mut repr = String::new();
    repr.push_str("c\"");
    for chunk in bytes.utf8_chunks() {
        for ch in chunk.valid().chars() {
            // Escapes \0, \t, \r, \n, \\, \', \", and uses \u{...} for non-printable characters.
            write!(repr, "{}", ch.escape_debug()).unwrap();
        }
        for byte in chunk.invalid() {
            write!(repr, "\\x{:02X}", byte).unwrap();
        }
    }
    repr.push('"');
    repr
}

fn main() {
    let lit = cstr_literal(b"\xferris the \xf0\x9f\xa6\x80\x07");
    let expected = stringify!(c"\xFErris the 🦀\u{7}");
    assert_eq!(lit, expected);
}

1.0.0 ·

pub fn sort(&mut self)where T: Ord,

Sorts the slice, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( n * log( n)) worst-case.

If the implementation of Ord for T does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn’t allocate auxiliary memory. See sort_unstable. The exception are partially sorted slices, which may be better served with slice::sort.

Sorting types that only implement PartialOrd such as f32 and f64 require additional precautions. For example, f32::NAN != f32::NAN, which doesn’t fulfill the reflexivity requirement of Ord. By using an alternative comparison function with slice::sort_by such as f32::total_cmp or f64::total_cmp that defines a total order users can sort slices containing floating-point values. Alternatively, if all values in the slice are guaranteed to be in a subset for which PartialOrd::partial_cmp forms a total order, it’s possible to sort the slice with sort_by(|a, b| a.partial_cmp(b).unwrap()).

Current implementation

The current implementation is based on driftsort by Orson Peters and Lukas Bergdoll, which combines the fast average case of quicksort with the fast worst case and partial run detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

The auxiliary memory allocation behavior depends on the input length. Short slices are handled without allocation, medium sized slices allocate self.len() and beyond that it clamps at self.len() / 2.

Panics

May panic if the implementation of Ord for T does not implement a total order, or if the Ord implementation itself panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4, -5, 1, -3, 2];

v.sort();
assert_eq!(v, [-5, -3, 1, 2, 4]);

1.0.0 ·

pub fn sort_by(&mut self, compare: F)where F: FnMut(&T, &T) -> Ordering,

Sorts the slice with a comparison function, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( n * log( n)) worst-case.

If the comparison function compare does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

For example |a, b| (a - b).cmp(a) is a comparison function that is neither transitive nor reflexive nor total, a < b < c < a with a = 1, b = 2, c = 3. For more information and examples see the Ord documentation.

Current implementation

The current implementation is based on driftsort by Orson Peters and Lukas Bergdoll, which combines the fast average case of quicksort with the fast worst case and partial run detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

The auxiliary memory allocation behavior depends on the input length. Short slices are handled without allocation, medium sized slices allocate self.len() and beyond that it clamps at self.len() / 2.

Panics

May panic if compare does not implement a total order, or if compare itself panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4, -5, 1, -3, 2];
v.sort_by(|a, b| a.cmp(b));
assert_eq!(v, [-5, -3, 1, 2, 4]);

// reverse sorting
v.sort_by(|a, b| b.cmp(a));
assert_eq!(v, [4, 2, 1, -3, -5]);

1.7.0 ·

pub fn sort_by_key<K, F>(&mut self, f: F)where F: FnMut(&T) -> K, K: Ord,

Sorts the slice with a key extraction function, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( m * n * log( n)) worst-case, where the key function is O( m).

If the implementation of Ord for K does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

Current implementation

The current implementation is based on driftsort by Orson Peters and Lukas Bergdoll, which combines the fast average case of quicksort with the fast worst case and partial run detection of mergesort, achieving linear time on fully sorted and reversed inputs. On inputs with k distinct elements, the expected time to sort the data is O( n * log( k)).

The auxiliary memory allocation behavior depends on the input length. Short slices are handled without allocation, medium sized slices allocate self.len() and beyond that it clamps at self.len() / 2.

Panics

May panic if the implementation of Ord for K does not implement a total order, or if the Ord implementation or the key-function f panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4i32, -5, 1, -3, 2];

v.sort_by_key(|k| k.abs());
assert_eq!(v, [1, 2, -3, 4, -5]);

1.34.0 ·

pub fn sort_by_cached_key<K, F>(&mut self, f: F)where F: FnMut(&T) -> K, K: Ord,

Sorts the slice with a key extraction function, preserving initial order of equal elements.

This sort is stable (i.e., does not reorder equal elements) and O( m * n + n * log( n)) worst-case, where the key function is O( m).

During sorting, the key function is called at most once per element, by using temporary storage to remember the results of key evaluation. The order of calls to the key function is unspecified and may change in future versions of the standard library.

If the implementation of Ord for K does not implement a total order, the function may panic; even if the function exits normally, the resulting order of elements in the slice is unspecified. See also the note on panicking below.

For simple key functions (e.g., functions that are property accesses or basic operations), sort_by_key is likely to be faster.

Current implementation

The current implementation is based on instruction-parallel-network sort by Lukas Bergdoll, which combines the fast average case of randomized quicksort with the fast worst case of heapsort, while achieving linear time on fully sorted and reversed inputs. And O( k * log( n)) where k is the number of distinct elements in the input. It leverages superscalar out-of-order execution capabilities commonly found in CPUs, to efficiently perform the operation.

In the worst case, the algorithm allocates temporary storage in a Vec<(K, usize)> the length of the slice.

Panics

May panic if the implementation of Ord for K does not implement a total order, or if the Ord implementation panics.

All safe functions on slices preserve the invariant that even if the function panics, all original elements will remain in the slice and any possible modifications via interior mutability are observed in the input. This ensures that recovery code (for instance inside of a Drop or following a catch_unwind) will still have access to all the original elements. For instance, if the slice belongs to a Vec, the Vec::drop method will be able to dispose of all contained elements.

Examples
let mut v = [4i32, -5, 1, -3, 2, 10];

// Strings are sorted by lexicographical order.
v.sort_by_cached_key(|k| k.to_string());
assert_eq!(v, [-3, -5, 1, 10, 2, 4]);

1.0.0 ·

pub fn to_vec(&self) -> Vecwhere T: Clone,

Copies self into a new Vec.

Examples
let s = [10, 40, 30];
let x = s.to_vec();
// Here, `s` and `x` can be modified independently.

pub fn to_vec_in(&self, alloc: A) -> Vec<T, A>where A: Allocator, T: Clone,

🔬This is a nightly-only experimental API. (allocator_api)

Copies self into a new Vec with an allocator.

Examples
#![feature(allocator_api)]

use std::alloc::System;

let s = [10, 40, 30];
let x = s.to_vec_in(System);
// Here, `s` and `x` can be modified independently.

1.40.0 ·

pub fn repeat(&self, n: usize) -> Vecwhere T: Copy,

Creates a vector by copying a slice n times.

Panics

This function will panic if the capacity would overflow.

Examples

Basic usage:

assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);

A panic upon overflow:ⓘ

// this will panic at runtime
b"0123456789abcdef".repeat(usize::MAX);

1.0.0 ·

pub fn concat(&self) -> <[T] as Concat>::Output ⓘwhere [T]: Concat, Item: ?Sized,

Flattens a slice of T into a single value Self::Output.

Examples
assert_eq!(["hello", "world"].concat(), "helloworld");
assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]);

1.3.0 ·

pub fn join( &self, sep: Separator, ) -> <[T] as Join>::Output ⓘwhere [T]: Join,

Flattens a slice of T into a single value Self::Output, placing a given separator between each.

Examples
assert_eq!(["hello", "world"].join(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]);
assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]);

1.0.0 ·

pub fn connect( &self, sep: Separator, ) -> <[T] as Join>::Output ⓘwhere [T]: Join,

👎Deprecated since 1.3.0: renamed to join

Flattens a slice of T into a single value Self::Output, placing a given separator between each.

Examples
assert_eq!(["hello", "world"].connect(" "), "hello world");
assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);

1.23.0 ·

pub fn to_ascii_uppercase(&self) -> Vec

Returns a vector containing a copy of this slice where each byte is mapped to its ASCII upper case equivalent.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

To uppercase the value in-place, use make_ascii_uppercase.1.23.0 ·

pub fn to_ascii_lowercase(&self) -> Vec

Returns a vector containing a copy of this slice where each byte is mapped to its ASCII lower case equivalent.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

To lowercase the value in-place, use make_ascii_lowercase.

Trait Implementations

impl Clone for Data

fn clone(&self) -> Data ⓘ

Returns a copy of the value. Read more1.0.0 ·

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for Data

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl Deref for Data

type Target = Vec

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target

Dereferences the value.

impl DerefMut for Data

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

impl PartialEq for Data

fn eq(&self, other: &Data) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl Read for Data

fn read(&mut self, buf: &mut [u8]) -> Result

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more1.36.0 ·

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)Determines if this Reader has an efficient read_vectoredimplementation. Read more1.0.0 ·

fn read_to_end(&mut self, buf: &mut Vec) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more1.0.0 ·

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more1.6.0 ·

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)Pull some bytes from this source into the specified buffer. Read more

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)Reads the exact number of bytes required to fill cursor. Read more1.0.0 ·

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more1.0.0 ·

fn bytes(self) -> Byteswhere Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more1.0.0 ·

fn chain(self, next: R) -> Chain<Self, R>where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more1.0.0 ·

fn take(self, limit: u64) -> Takewhere Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more

impl WireFormat for Data

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R) -> Result

Decodes Self from reader.

impl Eq for Data

impl StructuralPartialEq for Data

Auto Trait Implementations

impl Freeze for Data

impl RefUnwindSafe for Data

impl Send for Data

impl Sync for Data

impl Unpin for Data

impl UnwindSafe for Data

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<()>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async(reader: R) -> impl Future<Output = Result> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl CloneToUninit for Twhere T: Clone,

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)Performs copy-assignment from self to dst. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<P, T> Receiver for Pwhere P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)The target type on which the method may be called.

impl ToOwned for Twhere T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_wireformat

Struct P9String

pub struct P9String { /* private fields */ }

A 9P protocol string.

The string is always valid UTF-8 and 65535 bytes or less (enforced by P9String::new()).

It is represented as a C string with a terminating 0 (NUL) character to allow it to be passed directly to libc functions.

Implementations

impl P9String

pub fn new(string_bytes: impl Into<Vec>) -> Result

pub fn len(&self) -> usize

pub fn is_empty(&self) -> bool

pub fn as_c_str(&self) -> &CStr

pub fn as_bytes(&self) -> &[u8] ⓘ

pub fn as_ptr(&self) -> *const c_char

Returns a raw pointer to the string’s storage.

The string bytes are always followed by a NUL terminator (‘\0’), so the pointer can be passed directly to libc functions that expect a C string.

Trait Implementations

impl Clone for P9String

fn clone(&self) -> P9String

Returns a copy of the value. Read more1.0.0 ·

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

impl Debug for P9String

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

impl Hash for P9String

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more1.3.0 ·

fn hash_slice(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<&str> for P9String

fn eq(&self, other: &&str) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl PartialEq for P9String

fn eq(&self, other: &P9String) -> bool

Tests for self and other values to be equal, and is used by ==.1.0.0 ·

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

impl TryFrom<&OsStr> for P9String

type Error = Error

The type returned in the event of a conversion error.

fn try_from(value: &OsStr) -> Result

Performs the conversion.

impl WireFormat for P9String

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R) -> Result

Decodes Self from reader.

impl Eq for P9String

impl StructuralPartialEq for P9String

Auto Trait Implementations

impl Freeze for P9String

impl RefUnwindSafe for P9String

impl Send for P9String

impl Sync for P9String

impl Unpin for P9String

impl UnwindSafe for P9String

Blanket Implementations

impl Any for Twhere T: 'static + ?Sized,

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

impl AsyncWireFormatExt for Twhere T: WireFormat + Send,

fn encode_async(self, writer: W) -> impl Future<Output = Result<()>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer. Read more

fn decode_async(reader: R) -> impl Future<Output = Result> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader. Read more

impl Borrow for Twhere T: ?Sized,

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

impl BorrowMut for Twhere T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

impl CloneToUninit for Twhere T: Clone,

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)Performs copy-assignment from self to dst. Read more

impl ConvertWireFormat for Twhere T: WireFormat,

fn to_bytes(&self) -> Bytes

Converts the type to bytes. Returns a Bytes object containing the encoded bytes.

fn from_bytes(buf: &Bytes) -> Result<T, Error>

Converts bytes to the type. Returns a Result containing the decoded type or an std::io::Error if decoding fails.

fn as_bytes(&self) -> Vec

AsRef for the type. Read more

impl From for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Twhere U: From,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl ToOwned for Twhere T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom for Twhere U: Into,

type Error = Infallible

The type returned in the event of a conversion error.

fn try_from(value: U) -> Result<T, <T as TryFrom>::Error>

Performs the conversion.

impl<T, U> TryInto for Twhere U: TryFrom,

type Error = <U as TryFrom>::Error

The type returned in the event of a conversion error.

fn try_into(self) -> Result<U, <U as TryFrom>::Error>

Performs the conversion.

jetstream_wireformat

Trait WireFormat

pub trait WireFormat: Sized + Send {
    // Required methods
    fn byte_size(&self) -> u32;
    fn encode<W: Write>(&self, writer: &mut W) -> Result<()>;
    fn decode<R: Read>(reader: &mut R) -> Result<Self>;
}

A type that can be encoded on the wire using the 9P protocol.

Required Methods

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

Encodes self into writer.

fn decode<R: Read>(reader: &mut R) -> Result

Decodes Self from reader.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types

impl WireFormat for bool

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for f32

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for f64

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for i16

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for i32

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for i64

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for i128

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for isize

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for u8

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for u16

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for u32

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for u64

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for u128

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for ()

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

fn decode<R: Read>(_reader: &mut R) -> Result

impl WireFormat for usize

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for String

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for Ipv4Addr

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for Ipv6Addr

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for SocketAddrV4

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for SocketAddrV6

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl WireFormat for Optionwhere T: WireFormat,

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

impl<T: WireFormat> WireFormat for Vec

fn byte_size(&self) -> u32

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>

fn decode<R: Read>(reader: &mut R) -> Result

Implementors

impl WireFormat for Data

impl WireFormat for P9String

jetstream_wireformat

Module wire_format_extensions

Modules

Traits

  • Async``Wire``Format:
  • Convert``Wire``Format: A trait for converting types to and from a wire format.

jetstream_wireformat::wire_format_extensions

Module tokio

Traits

  • Async``Wire``Format``Ext: Extension trait for asynchronous wire format encoding and decoding.

jetstream_wireformat::wire_format_extensions::tokio

Trait AsyncWireFormatExt

pub trait AsyncWireFormatExtwhere
    Self: WireFormat + Send,{
    // Provided methods
    fn encode_async<W>(self, writer: W) -> impl Future<Output = Result<()>>
       where Self: Sync,
             W: AsyncWrite + Unpin + Send { ... }
    fn decode_async<R>(reader: R) -> impl Future<Output = Result<Self>> + Send
       where Self: Sync,
             R: AsyncRead + Unpin + Send { ... }
}

Extension trait for asynchronous wire format encoding and decoding.

Provided Methods

fn encode_async(self, writer: W) -> impl Future<Output = Result<()>>where Self: Sync, W: AsyncWrite + Unpin + Send,

Encodes the object asynchronously into the provided writer.

Arguments
  • writer - The writer to encode the object into.n
Returns

A future that resolves to an io::Result<()> indicating the success or failure of the encoding operation.

fn decode_async(reader: R) -> impl Future<Output = Result> + Sendwhere Self: Sync, R: AsyncRead + Unpin + Send,

Decodes an object asynchronously from the provided reader.

Arguments
  • reader - The reader to decode the object from.
Returns

A future that resolves to an io::Result<Self> indicating the success or failure of the decoding operation.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

impl<T: WireFormat + Send> AsyncWireFormatExt for T

Implements the AsyncWireFormatExt trait for types that implement the WireFormat trait and can be sent across threads.

jetstream_wireformat::wire_format_extensions

Trait AsyncWireFormat

pub trait AsyncWireFormat: Sized {
    // Required methods
    fn encode_async<W: AsyncWireFormat + Unpin + Send>(
        self,
        writer: &mut W,
    ) -> impl Future<Output = Result<()>> + Send;
    fn decode_async<R: AsyncWireFormat + Unpin + Send>(
        reader: &mut R,
    ) -> impl Future<Output = Result<Self>> + Send;
}

Required Methods

fn encode_async<W: AsyncWireFormat + Unpin + Send>( self, writer: &mut W, ) -> impl Future<Output = Result<()>> + Send

fn decode_async<R: AsyncWireFormat + Unpin + Send>( reader: &mut R, ) -> impl Future<Output = Result> + Send

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

jetstream_wireformat::wire_format_extensions

Trait ConvertWireFormat

pub trait ConvertWireFormat: WireFormat {
    // Required methods
    fn to_bytes(&self) -> Bytes;
    fn from_bytes(buf: &Bytes) -> Result<Self, Error>;

    // Provided method
    fn as_bytes(&self) -> Vec<u8> ⓘ { ... }
}

A trait for converting types to and from a wire format.

Required Methods

fn to_bytes(&self) -> Bytes

Converts the type to a byte representation.

Returns

A Bytes object representing the byte representation of the type.

fn from_bytes(buf: &Bytes) -> Result<Self, Error>

Converts a byte buffer to the type.

Arguments
  • buf - A mutable reference to a Bytes object containing the byte buffer.
Returns

A Result containing the converted type or an std::io::Error if the conversion fails.

Provided Methods

fn as_bytes(&self) -> Vec

AsRef< u8> for the type.

Returns

A reference to the byte representation of the type.

Dyn Compatibility

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors

impl ConvertWireFormat for Twhere T: WireFormat,

Implements the ConvertWireFormat trait for types that implement jetstream_p9::WireFormat. This trait provides methods for converting the type to and from bytes.