public some traits and functions
This commit is contained in:
parent
aac3e3a76b
commit
a4c1d2c0b5
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "FCPv2"
|
name = "fcpv2"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Horhik <horhik@tuta.io>"]
|
authors = ["Horhik <horhik@tuta.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mod types;
|
mod types;
|
||||||
use types::fcp_types;
|
pub use types::client;
|
||||||
|
pub use types::node;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
@ -2,7 +2,7 @@ use super::types::*;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
impl ClientHello {
|
impl ClientHello {
|
||||||
fn new(name: String, exp_ver: f32) -> Self {
|
pub fn new(name: String, exp_ver: f32) -> Self {
|
||||||
ClientHello {
|
ClientHello {
|
||||||
name: name,
|
name: name,
|
||||||
expected_version: exp_ver,
|
expected_version: exp_ver,
|
||||||
|
@ -15,7 +15,7 @@ impl FcpRequest for ClientHello {
|
||||||
return format!(
|
return format!(
|
||||||
"ClientHello\n\
|
"ClientHello\n\
|
||||||
Name={}\n\
|
Name={}\n\
|
||||||
ExpectedVersion={}\n\
|
ExpectedVersion={:?}\n\
|
||||||
EndMessage\n\n",
|
EndMessage\n\n",
|
||||||
self.name, self.expected_version
|
self.name, self.expected_version
|
||||||
);
|
);
|
||||||
|
@ -176,7 +176,7 @@ fn is_keypair_parsing() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
trait FcpParser<T> {
|
pub trait FcpParser<T> {
|
||||||
fn parse(palin: &str) -> Option<T>;
|
fn parse(palin: &str) -> Option<T>;
|
||||||
}
|
}
|
||||||
impl FcpParser<SSK> for SSK {
|
impl FcpParser<SSK> for SSK {
|
||||||
|
@ -393,7 +393,7 @@ impl FcpRequest for ClientPut {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientPut {
|
impl ClientPut {
|
||||||
fn new_default(uri: SSK, filename: &str, identifier: &str, data: &str) -> ClientPut {
|
pub fn new_default(uri: SSK, filename: &str, identifier: &str, data: &str) -> ClientPut {
|
||||||
ClientPut {
|
ClientPut {
|
||||||
uri: uri,
|
uri: uri,
|
||||||
data_length: data.len(),
|
data_length: data.len(),
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
mod client;
|
pub mod client;
|
||||||
mod node;
|
pub mod node;
|
||||||
|
|
||||||
pub use client::*;
|
|
||||||
|
|
Loading…
Reference in a new issue