1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 18:09:22 +02:00

use workspace

This commit is contained in:
Nikolay Kim
2017-12-31 21:55:25 -08:00
parent 8e89ff1d1e
commit d2f54b7d19
18 changed files with 53 additions and 20 deletions

View File

@ -2,6 +2,7 @@
name = "template-tera"
version = "0.1.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
workspace = "../.."
[dependencies]
env_logger = "0.4"

View File

@ -6,7 +6,9 @@ extern crate tera;
use actix::*;
use actix_web::*;
#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe};
#[cfg(unix)]
use actix::actors::signal::{ProcessSignals, Subscribe};
struct State {
template: tera::Tera, // <- store tera template in application state
@ -43,7 +45,8 @@ fn main() {
.bind("127.0.0.1:8080").unwrap()
.start();
if cfg!(target_os = "linux") { // Subscribe to unix signals
#[cfg(unix)]
{ // Subscribe to unix signals
let signals = Arbiter::system_registry().get::<ProcessSignals>();
signals.send(Subscribe(addr.subscriber()));
}