Addded statis field.
All checks were successful
MoreThanText/morethantext/pipeline/head This commit looks good

This commit is contained in:
Jeff Baskin 2025-02-10 08:05:59 -05:00
parent aed94d7eac
commit 74c64890e2
2 changed files with 47 additions and 3 deletions

View File

@ -4,12 +4,12 @@ pub mod id;
mod record;
pub mod table;
use super::Message;
use std::{
collections::BTreeMap,
sync::mpsc::{Receiver, Sender, channel},
sync::mpsc::{channel, Receiver, Sender},
thread::spawn,
};
use super::Message;
use uuid::Uuid;
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Debug)]

View File

@ -13,6 +13,47 @@ use std::sync::mpsc::{channel, Sender};
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 Response {
@ -32,7 +73,10 @@ impl Response {
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());
}
}