/
germanubis
/
sqlx
Обзор
Документация
Войти
/
germanubis
/
sqlx
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
sqlx-core/src/io/decode.rs
29 строк
575 B
Austin Bonander
refactor: rename `sqlx_core::io::{Encode, Decode}` for clarity
24 авг 2024, 09:39
24 авг 2024, 09:39
9b3808b
Код
Авторство
О чём код?
use bytes::Bytes; use crate::error::Error; pub trait ProtocolDecode<'de, Context = ()> where Self: Sized, { fn decode(buf: Bytes) -> Result<Self, Error> where Self: ProtocolDecode<'de, ()>, { Self::decode_with(buf, ()) } fn decode_with(buf: Bytes, context: Context) -> Result<Self, Error>; } impl ProtocolDecode<'_> for Bytes { fn decode_with(buf: Bytes, _: ()) -> Result<Self, Error> { Ok(buf) } } impl ProtocolDecode<'_> for () { fn decode_with(_: Bytes, _: ()) -> Result<(), Error> { Ok(()) } }