tiberius/tds/codec/token/
token_info.rsuse crate::SqlReadBytes;
#[allow(dead_code)] #[derive(Debug)]
pub struct TokenInfo {
pub(crate) number: u32,
pub(crate) state: u8,
pub(crate) class: u8,
pub(crate) message: String,
pub(crate) server: String,
pub(crate) procedure: String,
pub(crate) line: u32,
}
impl TokenInfo {
pub(crate) async fn decode<R>(src: &mut R) -> crate::Result<Self>
where
R: SqlReadBytes + Unpin,
{
let _length = src.read_u16_le().await?;
let number = src.read_u32_le().await?;
let state = src.read_u8().await?;
let class = src.read_u8().await?;
let message = src.read_us_varchar().await?;
let server = src.read_b_varchar().await?;
let procedure = src.read_b_varchar().await?;
let line = src.read_u32_le().await?;
Ok(TokenInfo {
number,
state,
class,
message,
server,
procedure,
line,
})
}
}