0
votes

I'm trying to build rustless on Windows:

This is my Cargo.toml:

[dependencies.rustless]
git = "https://github.com/rustless/rustless"

[package]

name = "ccampo_substancias_srv"
version = "0.0.1"
authors = [ "------------------------------" ]

[[bin]]

name = "Rest_test"

This is main.rs:

#![feature(plugin)]

#[plugin]
extern crate rustless;
extern crate hyper;
extern crate iron;
extern crate "rustc-serialize" as rustc_serialize;
extern crate valico;

use hyper::status::StatusCode;
use iron::Iron;
use rustless::{
    Application, Api, Nesting, Versioning
};
use rustc_serialize::json::ToJson;

fn main() {

    let api = Api::build(dsl!(|api| {
        // Specify API version
        version("v1", Versioning::AcceptHeader("chat"));
        prefix("api");

        // Create API for chats
        mount(Api::build(dsl!(|chats_api| {

            after(|client, _params| {
                client.set_status(StatusCode::NotFound);
                Ok(())
            });

            // Add namespace
            namespace("chats/:id", dsl!(|chat_ns| {

                // Valico settings for this namespace
                params(|params| {
                    params.req_typed("id", valico::u64())
                });

                // Create endpoint for POST /chats/:id/users/:user_id
                post("users/:user_id", dsl!(|endpoint| {

                    // Add description
                    desc("Update user");

                    // Valico settings for endpoint params
                    params(|params| {
                        params.req_typed("user_id", valico::u64());
                        params.req_typed("name", valico::string())
                    });

                    handle(|client, params| {
                        client.json(&params.to_json())
                    })
                }));

            }));
        })));
    }));

    let app = Application::new(api);

    Iron::new(app).listen("localhost:4000").unwrap();
    println!("On 4000");

    println!("Rustless server started!");
}

Building with "cargo build --verbose" and rust 1.5 (64bit) on Windows 10. This is the error I'm getting, looks like it's related to some file path:

 Fresh jsonway v0.3.5

 Fresh conduit-mime-types v0.7.3

 Fresh winapi v0.2.5

 Build failed, waiting for other jobs to finish...

 could not rename crate "C:\\Users\\Pedro\\workspace\\ccampo-substancias-srv\\target\\debug\\build\\advapi32-sys-cfef7a1f30f1e5f6\\build_script_build.exe"

Caused by:   Acesso negado. (os error 5)
1
ty for the input it's Cargo.toml @Shepmaster - xistoso

1 Answers

2
votes

Do you have antivirus/anti-malware software on your computer? It might be trying to analyze your program, locking the file. Try disabling it temporarily or adding an exception on your project directory, then try building again.