Adding data retrival.
All checks were successful
MoreThanText/morethantext/pipeline/head This commit looks good
All checks were successful
MoreThanText/morethantext/pipeline/head This commit looks good
This commit is contained in:
48
src/lib.rs
48
src/lib.rs
@ -11,6 +11,54 @@ use router::Router;
|
||||
use session::{Session, SessionData, SessionMsg};
|
||||
use std::sync::mpsc::{channel, Sender};
|
||||
|
||||
struct Request;
|
||||
|
||||
struct Record;
|
||||
|
||||
struct Response {
|
||||
headers: Vec<String>,
|
||||
records: Vec<Record>,
|
||||
}
|
||||
|
||||
impl Response {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
headers: Vec::new(),
|
||||
records: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn count(&self) -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
fn add_header<S>(&mut self, name: S) where S: Into<String> {
|
||||
self.headers.push(name.into());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod responses {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn create_response() {
|
||||
let res = Response::new();
|
||||
assert!(res.headers.is_empty());
|
||||
assert!(res.records.is_empty());
|
||||
assert_eq!(res.count(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn addA_header() {
|
||||
let mut res = Response::new();
|
||||
res.add_header("one");
|
||||
assert_eq!(res.headers, ["one"]);
|
||||
res.add_header("two".to_string());
|
||||
assert_eq!(res.headers, ["one", "two"]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Support functions for Messages.
|
||||
pub trait Msg {
|
||||
fn to_msgdata(&self) -> MsgData;
|
||||
|
Reference in New Issue
Block a user