Adding data retrival.
All checks were successful
MoreThanText/morethantext/pipeline/head This commit looks good

This commit is contained in:
2025-02-09 15:48:13 -05:00
parent 731cd01613
commit aed94d7eac
3 changed files with 197 additions and 29 deletions

View File

@ -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;