Browse Source

And remove said unimportant files

master
Bradlee Speice 4 years ago
parent
commit
b267877ae0
3 changed files with 0 additions and 85 deletions
  1. +0
    -20
      src/bassdrive.rs
  2. +0
    -18
      src/broadcast.rs
  3. +0
    -47
      src/main_hyper.rs.bak

+ 0
- 20
src/bassdrive.rs View File

@@ -1,20 +0,0 @@
extern crate hyper;
extern crate rss;

use rss::Channel;
use std::str::FromStr;

use broadcast::Broadcaster;

pub struct BassDrive {
pub url: String
}

impl BassDrive {
}

impl Broadcaster for BassDrive {
fn broadcast(&self) -> Channel {
Channel::from_str("").unwrap()
}
}

+ 0
- 18
src/broadcast.rs View File

@@ -1,18 +0,0 @@
extern crate rss;
extern crate hyper;

use hyper::server::{Request, Response};
use rss::Channel;

pub trait Broadcaster {
fn broadcast(&self) -> Channel;
}

#[allow(unused)]
pub fn build_broadcast<T: Broadcaster>(b: T) -> Box<Fn(Request, Response)> {
let channel = b.broadcast();

Box::new(move |_: Request, res: Response| {
res.send(channel.to_string().as_bytes());
})
}

+ 0
- 47
src/main_hyper.rs.bak View File

@@ -1,47 +0,0 @@
extern crate hyper;
extern crate reroute;
extern crate rss;

use hyper::server::{Server, Request, Response, Handler};
use reroute::{Router, Captures};

mod broadcast;
mod bassdrive;

#[allow(unused)]
fn http_404(req: Request, res: Response) {
res.send(format!("Couldn't find URL: {}", req.uri).as_bytes());
}

struct EchoHandler {
response: String
}

impl EchoHandler {
fn handle(&self, _: Request, res: Response, _: Captures) {
res.send(self.response.as_bytes());
}
}


#[allow(unused)]
fn main() {
let mut router = Router::new();

let echo = EchoHandler {
response: "Hello, world!".to_string()
};
router.get(r"/hello", echo);

/*
router.get(r"/hello", build_broadcast(
BassDrive {
url: "http://archives.bassdrivearchive.com/6%20-%20Saturday/Electronic%20Warfare%20-%20The%20Overfiend/"
})
);
*/
router.add_not_found(http_404);
router.finalize().unwrap();

Server::http("0.0.0.0:3000").unwrap().handle(router).unwrap();
}

Loading…
Cancel
Save