make more types public (#59)

This commit is contained in:
Carl Lerche
2020-07-15 14:21:17 -07:00
committed by GitHub
parent b7bab20d0c
commit 16be963908
2 changed files with 7 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
//! Provides a type representing a Redis protocol frame as well as utilities for
//! parsing frames from a byte array.
use bytes::{Buf, Bytes}; use bytes::{Buf, Bytes};
use std::convert::TryInto; use std::convert::TryInto;
use std::fmt; use std::fmt;
@@ -17,7 +20,7 @@ pub enum Frame {
} }
#[derive(Debug)] #[derive(Debug)]
pub(crate) enum Error { pub enum Error {
/// Not enough data is available to parse a message /// Not enough data is available to parse a message
Incomplete, Incomplete,
@@ -60,7 +63,7 @@ impl Frame {
} }
/// Checks if an entire message can be decoded from `src` /// Checks if an entire message can be decoded from `src`
pub(crate) fn check(src: &mut Cursor<&[u8]>) -> Result<(), Error> { pub fn check(src: &mut Cursor<&[u8]>) -> Result<(), Error> {
match get_u8(src)? { match get_u8(src)? {
b'+' => { b'+' => {
get_line(src)?; get_line(src)?;
@@ -100,7 +103,7 @@ impl Frame {
} }
/// The message has already been validated with `scan`. /// The message has already been validated with `scan`.
pub(crate) fn parse(src: &mut Cursor<&[u8]>) -> Result<Frame, Error> { pub fn parse(src: &mut Cursor<&[u8]>) -> Result<Frame, Error> {
match get_u8(src)? { match get_u8(src)? {
b'+' => { b'+' => {
// Read the line and convert it to `Vec<u8>` // Read the line and convert it to `Vec<u8>`

View File

@@ -33,7 +33,7 @@ pub use cmd::Command;
mod connection; mod connection;
pub use connection::Connection; pub use connection::Connection;
mod frame; pub mod frame;
pub use frame::Frame; pub use frame::Frame;
mod db; mod db;