Addded statis field.
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:
parent
aed94d7eac
commit
74c64890e2
@ -4,12 +4,12 @@ pub mod id;
|
|||||||
mod record;
|
mod record;
|
||||||
pub mod table;
|
pub mod table;
|
||||||
|
|
||||||
|
use super::Message;
|
||||||
use std::{
|
use std::{
|
||||||
collections::BTreeMap,
|
collections::BTreeMap,
|
||||||
sync::mpsc::{Receiver, Sender, channel},
|
sync::mpsc::{channel, Receiver, Sender},
|
||||||
thread::spawn,
|
thread::spawn,
|
||||||
};
|
};
|
||||||
use super::Message;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Debug)]
|
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Debug)]
|
||||||
|
46
src/lib.rs
46
src/lib.rs
@ -13,6 +13,47 @@ use std::sync::mpsc::{channel, Sender};
|
|||||||
|
|
||||||
struct Request;
|
struct Request;
|
||||||
|
|
||||||
|
enum Field {
|
||||||
|
Static(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<String> for Field {
|
||||||
|
fn from(value: String) -> Self {
|
||||||
|
Field::Static(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&str> for Field {
|
||||||
|
fn from(value: &str) -> Self {
|
||||||
|
Field::Static(value.to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod fields {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn string_to_field() {
|
||||||
|
let entries = ["test1".to_string(), "test2".to_string()];
|
||||||
|
for data in entries {
|
||||||
|
match data.clone().into() {
|
||||||
|
Field::Static(result) => assert_eq!(result, data),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn str_to_field() {
|
||||||
|
let entries = ["test1", "test2"];
|
||||||
|
for data in entries {
|
||||||
|
match data.into() {
|
||||||
|
Field::Static(result) => assert_eq!(result, data),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct Record;
|
struct Record;
|
||||||
|
|
||||||
struct Response {
|
struct Response {
|
||||||
@ -32,7 +73,10 @@ impl Response {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_header<S>(&mut self, name: S) where S: Into<String> {
|
fn add_header<S>(&mut self, name: S)
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
self.headers.push(name.into());
|
self.headers.push(name.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user