Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Devolutions/IronRDP/llms.txt
Use this file to discover all available pages before exploring further.
Version: 0.1.5
Docs.rs: ironrdp-core
Docs.rs: ironrdp-core
Overview
Theironrdp-core crate provides foundational traits and types used throughout IronRDP. It defines the core encoding/decoding infrastructure, cursor utilities, and error types that form the basis of all PDU operations.
Key Design Principles
no_stdcompatible: Core functionality works without the standard library- Object-safe traits: Enables dynamic dispatch for protocol PDUs
- Zero-copy parsing: Uses cursors instead of allocating intermediate buffers
- Type-safe encoding: Size is computed before writing to prevent buffer overruns
Core Traits
Encode
encode()- Writes the PDU to aWriteCursorname()- Returns a static name for debugging/loggingsize()- Computes the exact size in bytes before encoding
Decode
'de allows zero-copy parsing.
Helper Functions:
DecodeOwned
Decode but unconditionally returns an owned type (no lifetime parameter). Use when you need to own the decoded data.
Cursor Types
ReadCursor
Create a new cursor from a byte slice
Read a single byte
Read a little-endian u16
Read a big-endian u16
Read a little-endian u32
Read a slice of n bytes
Get the remaining unread bytes
Number of bytes remaining
Current position in the buffer
WriteCursor
Create a new cursor from a mutable byte slice
Write a single byte
Write a little-endian u16
Write a big-endian u16
Write a little-endian u32
Write a slice of bytes
Current position (number of bytes written)
WriteBuf
Vec<u8> internally. Maintains separate “filled” and “unfilled” regions.
Requires the
alloc feature. Use WriteBuf when the output size is not known in advance.Create a new empty buffer
Get a mutable slice of at least
size bytes, growing if necessaryMark
n bytes as filled after writing to unfilled_to()Get the filled portion of the buffer
Reset the filled region without deallocating
Error Types
EncodeError & DecodeError
Features
Enables standard library support (includes
alloc)Enables heap allocations (
WriteBuf, Vec support)Usage Notes
WriteCursor vs WriteBuf:- Use
WriteCursorwhen you know the exact size and want syscall-free, infallible writes - Use
WriteBufwhen size is unknown and you need the buffer to grow automatically WriteCursorwraps&mut [u8]for stack/static buffersWriteBufmanagesVec<u8>internally and can resize
Object Safety:
The
The
Encode trait is intentionally object-safe to enable dynamic dispatch:See Also
- ironrdp-pdu - PDU definitions that use these traits
- ironrdp-svc - Static virtual channel traits
- ARCHITECTURE.md - Crate architecture

