ms-ndr 0.1.2

Pure-Rust NDR (Network Data Representation) marshaling — the DCE/RPC transfer syntax (MS-RPCE, little-endian): aligned primitives, conformant & varying arrays, unique (referent) pointers, and conformant-varying UTF-16 strings. No FFI.
Documentation
# ms-ndr

Pure-Rust **NDR (Network Data Representation)** marshaling — the DCE/RPC transfer syntax
(MS-RPCE), little-endian. No FFI, no `unsafe`.

This is the foundation layer every MS-RPCE interface rides on. It turns Rust values into
NDR bytes and back; it knows nothing about transports, PDUs, or specific interfaces.

## What it covers

- Aligned primitives (`u8`/`u16`/`u32`/`u64`, `uuid`) — alignment relative to the start of
  the stub buffer, matching the NDR rule that an aggregate aligns to its largest member.
- Unique (referent) pointers — fresh referent ids from `0x00020000`, stepping by 4.
- Conformant + varying UTF-16 strings — the `[size_is][length_is]` wchar payload used by
  `RPC_UNICODE_STRING`.
- Raw byte reads for fixed context handles / tower blobs.

## Usage

```rust
use ms_ndr::{NdrEncoder, NdrDecoder};

let mut e = NdrEncoder::new();
e.u32(0x1234);
e.conformant_varying_wstr("HOSTNAME");
let stub = e.into_bytes();

let mut d = NdrDecoder::new(&stub);
let n = d.u32()?;
let name = d.conformant_varying_wstr()?;
# Ok::<(), ms_ndr::NdrError>(())
```

Extracted from and used by [`dcerpc`](https://crates.io/crates/dcerpc).

## License

MIT