feat(ctrader-openapi): length-delimited protobuf codec
CTraderCodec implements tokio_util Decoder+Encoder with 4-byte BE length prefix framing. Handles partial frames, multiple frames in buffer, and rejects oversized frames (16 MiB max). 5 unit tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,16 @@ pub enum CTraderError {
|
||||
/// Symbol not found in the cached symbol list.
|
||||
#[error("unknown symbol: {0}")]
|
||||
UnknownSymbol(String),
|
||||
|
||||
/// I/O error (required by `tokio_util::codec`).
|
||||
#[error("io error: {0}")]
|
||||
Io(String),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for CTraderError {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Self::Io(e.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Rate-limit bucket categories.
|
||||
|
||||
Reference in New Issue
Block a user