mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
be explicit about imported and exported types
This commit is contained in:
parent
749d0abf79
commit
3f527b176c
10 changed files with 110 additions and 111 deletions
|
@ -19,12 +19,15 @@ pub mod variable;
|
|||
|
||||
pub use keyword::Keyword;
|
||||
pub use method::Method;
|
||||
pub use method_types::*;
|
||||
pub use parser::*;
|
||||
pub use packet::*;
|
||||
pub use packet_id::*;
|
||||
pub use uniform::*;
|
||||
pub use method_types::{PsycMethod, MethodInfo, PsycMethodFlags};
|
||||
pub use method_types::{PSYC_METHOD_TEMPLATE, PSYC_METHOD_REPLY, PSYC_METHOD_VISIBLE, PSYC_METHOD_LOGGABLE, PSYC_METHOD_MANUAL};
|
||||
pub use parser::{PsycParser, PsycListParser, Parser};
|
||||
pub use parser_types::{PsycParserResult, PsycListParserResult, PsycParserError, PsycListParserError};
|
||||
pub use packet::{PsycList, PsycModifier, PsycPacket};
|
||||
pub use packet_id::PacketId;
|
||||
pub use packet_types::PacketRenderError;
|
||||
pub use uniform::Uniform;
|
||||
pub use uniform_types::{UniformParseError, PsycScheme, PsycEntity};
|
||||
pub use packet_types::{PsycOperator, PsycStateOp};
|
||||
pub use variable::*;
|
||||
pub use variable::{RoutingVariable, EntityVariable, Variable};
|
||||
pub use variable_types::{PsycRoutingVar, PsycType};
|
||||
|
|
|
@ -10,7 +10,6 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycMethod {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use types::*;
|
||||
use types::PsycString;
|
||||
use packet_types::*;
|
||||
use packet_id::*;
|
||||
use packet_id::PacketId;
|
||||
use util;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
@ -70,14 +70,6 @@ pub struct PsycPacket<'a> {
|
|||
body: &'a [u8]
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycRenderError {
|
||||
MethodMissing = PsycRenderRC::PSYC_RENDER_ERROR_METHOD_MISSING as _,
|
||||
ModifierNameMissing = PsycRenderRC::PSYC_RENDER_ERROR_MODIFIER_NAME_MISSING as _,
|
||||
GenericError = PsycRenderRC::PSYC_RENDER_ERROR as _
|
||||
}
|
||||
|
||||
impl PsycList {
|
||||
/// Construct a PsycList from a list of byte lists
|
||||
pub fn new(list: &[&[u8]]) -> Self {
|
||||
|
@ -212,7 +204,7 @@ impl<'a> PsycPacket<'a> {
|
|||
}
|
||||
|
||||
///
|
||||
pub fn render(&self) -> Result<Vec<u8>, PsycRenderError> {
|
||||
pub fn render(&self) -> Result<Vec<u8>, PacketRenderError> {
|
||||
let raw_packet_ptr = & self.raw_packet as *const RawPsycPacket;
|
||||
let mut buffer = Vec::with_capacity(self.length());
|
||||
let buffer_ptr = buffer.as_mut_ptr() as *mut c_char;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use packet_types::{RawPsycList, PsycElem};
|
||||
use parser::{PsycListParser, PsycListParserResult};
|
||||
use parser::PsycListParser;
|
||||
use parser_types::PsycListParserResult;
|
||||
use util;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
|
|
@ -116,3 +116,11 @@ pub enum PsycRenderRC {
|
|||
/// Packet is rendered successfully in the buffer.
|
||||
PSYC_RENDER_SUCCESS = 0,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PacketRenderError {
|
||||
MethodMissing = PsycRenderRC::PSYC_RENDER_ERROR_METHOD_MISSING as _,
|
||||
ModifierNameMissing = PsycRenderRC::PSYC_RENDER_ERROR_MODIFIER_NAME_MISSING as _,
|
||||
GenericError = PsycRenderRC::PSYC_RENDER_ERROR as _
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use types::*;
|
||||
use types::PsycString;
|
||||
use parser_types::*;
|
||||
use util;
|
||||
use std::mem;
|
||||
|
@ -31,93 +31,6 @@ pub struct PsycListParser {
|
|||
state: PsycParseListState
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycParserResult<'a> {
|
||||
StateSync,
|
||||
StateReset,
|
||||
Complete,
|
||||
InsufficientData,
|
||||
RoutingModifier {
|
||||
operator: char,
|
||||
name: &'a [u8],
|
||||
value: &'a [u8]
|
||||
},
|
||||
EntityModifier {
|
||||
operator: char,
|
||||
name: &'a [u8],
|
||||
value: &'a [u8]
|
||||
},
|
||||
EntityModifierStart {
|
||||
operator: char,
|
||||
name: &'a [u8],
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
EntityModifierCont {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
EntityModifierEnd {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
Body {
|
||||
method: &'a [u8],
|
||||
data: &'a [u8]
|
||||
},
|
||||
BodyStart {
|
||||
method: &'a [u8],
|
||||
data_part: &'a [u8]
|
||||
},
|
||||
BodyCont {
|
||||
data_part: &'a [u8]
|
||||
},
|
||||
BodyEnd {
|
||||
data_part: &'a [u8]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycListParserResult<'a> {
|
||||
Complete,
|
||||
InsufficientData,
|
||||
ListElement {
|
||||
value: &'a [u8]
|
||||
},
|
||||
ListElementStart {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
ListElementCont {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
ListElementEnd {
|
||||
value_part: &'a [u8]
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycParserError {
|
||||
NoModifierLength = PsycParseRC::PSYC_PARSE_ERROR_MOD_NO_LEN as _,
|
||||
NoContentLength = PsycParseRC::PSYC_PARSE_ERROR_NO_LEN as _,
|
||||
NoEndDelimiter = PsycParseRC::PSYC_PARSE_ERROR_END as _,
|
||||
NoNewlineAfterMethod = PsycParseRC::PSYC_PARSE_ERROR_METHOD as _,
|
||||
NoNewlineAfterModifier = PsycParseRC::PSYC_PARSE_ERROR_MOD_NL as _,
|
||||
InvalidModifierLength = PsycParseRC::PSYC_PARSE_ERROR_MOD_LEN as _,
|
||||
NoTabBeforeModifierValue = PsycParseRC::PSYC_PARSE_ERROR_MOD_TAB as _,
|
||||
NoModifierName = PsycParseRC::PSYC_PARSE_ERROR_MOD_NAME as _,
|
||||
NoNewlineAfterContentLength = PsycParseRC::PSYC_PARSE_ERROR_LENGTH as _,
|
||||
GenericError = PsycParseRC::PSYC_PARSE_ERROR as _,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycListParserError {
|
||||
NoElementLength = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_NO_LEN as _,
|
||||
InvalidElementLength = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_LENGTH as _,
|
||||
InvalidElementType = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_TYPE as _,
|
||||
InvalidElementStart = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_START as _,
|
||||
InvalidType = PsycParseListRC::PSYC_PARSE_LIST_ERROR_TYPE as _,
|
||||
GenericError = PsycParseListRC::PSYC_PARSE_LIST_ERROR as _,
|
||||
}
|
||||
|
||||
impl PsycParser {
|
||||
/// Create a PsycParser
|
||||
pub fn new() -> Self {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
use types::*;
|
||||
use types::PsycString;
|
||||
|
||||
enum PsycPart { }
|
||||
enum PsycListPart { }
|
||||
|
@ -265,6 +265,89 @@ pub enum PsycParseUpdateRC {
|
|||
PSYC_PARSE_UPDATE_END = 27,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycParserResult<'a> {
|
||||
StateSync,
|
||||
StateReset,
|
||||
Complete,
|
||||
InsufficientData,
|
||||
RoutingModifier {
|
||||
operator: char,
|
||||
name: &'a [u8],
|
||||
value: &'a [u8]
|
||||
},
|
||||
EntityModifier {
|
||||
operator: char,
|
||||
name: &'a [u8],
|
||||
value: &'a [u8]
|
||||
},
|
||||
EntityModifierStart {
|
||||
operator: char,
|
||||
name: &'a [u8],
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
EntityModifierCont {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
EntityModifierEnd {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
Body {
|
||||
method: &'a [u8],
|
||||
data: &'a [u8]
|
||||
},
|
||||
BodyStart {
|
||||
method: &'a [u8],
|
||||
data_part: &'a [u8]
|
||||
},
|
||||
BodyCont {
|
||||
data_part: &'a [u8]
|
||||
},
|
||||
BodyEnd {
|
||||
data_part: &'a [u8]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycListParserResult<'a> {
|
||||
Complete,
|
||||
InsufficientData,
|
||||
ListElement {
|
||||
value: &'a [u8]
|
||||
},
|
||||
ListElementStart {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
ListElementCont {
|
||||
value_part: &'a [u8]
|
||||
},
|
||||
ListElementEnd {
|
||||
value_part: &'a [u8]
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycParserError {
|
||||
NoModifierLength = PsycParseRC::PSYC_PARSE_ERROR_MOD_NO_LEN as _,
|
||||
NoContentLength = PsycParseRC::PSYC_PARSE_ERROR_NO_LEN as _,
|
||||
NoEndDelimiter = PsycParseRC::PSYC_PARSE_ERROR_END as _,
|
||||
NoNewlineAfterMethod = PsycParseRC::PSYC_PARSE_ERROR_METHOD as _,
|
||||
NoNewlineAfterModifier = PsycParseRC::PSYC_PARSE_ERROR_MOD_NL as _,
|
||||
InvalidModifierLength = PsycParseRC::PSYC_PARSE_ERROR_MOD_LEN as _,
|
||||
NoTabBeforeModifierValue = PsycParseRC::PSYC_PARSE_ERROR_MOD_TAB as _,
|
||||
NoModifierName = PsycParseRC::PSYC_PARSE_ERROR_MOD_NAME as _,
|
||||
NoNewlineAfterContentLength = PsycParseRC::PSYC_PARSE_ERROR_LENGTH as _,
|
||||
GenericError = PsycParseRC::PSYC_PARSE_ERROR as _,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycListParserError {
|
||||
NoElementLength = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_NO_LEN as _,
|
||||
InvalidElementLength = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_LENGTH as _,
|
||||
InvalidElementType = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_TYPE as _,
|
||||
InvalidElementStart = PsycParseListRC::PSYC_PARSE_LIST_ERROR_ELEM_START as _,
|
||||
InvalidType = PsycParseListRC::PSYC_PARSE_LIST_ERROR_TYPE as _,
|
||||
GenericError = PsycParseListRC::PSYC_PARSE_LIST_ERROR as _,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use types::*;
|
||||
use types::PsycString;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PsycEntity<'a> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
extern crate psyc;
|
||||
use psyc::parser::*;
|
||||
use psyc::*;
|
||||
|
||||
#[test]
|
||||
fn test_parse() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
extern crate psyc;
|
||||
use psyc::parser::*;
|
||||
use psyc::*;
|
||||
|
||||
#[test]
|
||||
fn test_parse() {
|
||||
|
|
Loading…
Reference in a new issue