CSC/ECE 517 Spring 2015/oss M1502 GVJ: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 16: Line 16:
To incorporate new crates in to a project in rust, two main tasks are needed. First, depending on the crate that is used, a dependency needs to be added to the relevant Cargo.toml. For servo and websocket, that Cargo.toml is related to the script component, found in servo's components/script folder. To add a dependency to the Cargo.toml file, a couple different methods are available, both with separate advantages.  
To incorporate new crates in to a project in rust, two main tasks are needed. First, depending on the crate that is used, a dependency needs to be added to the relevant Cargo.toml. For servo and websocket, that Cargo.toml is related to the script component, found in servo's components/script folder. To add a dependency to the Cargo.toml file, a couple different methods are available, both with separate advantages.  


The first method is the simplest, and allows specification of crate versions through a method similar to Ruby gemfiles. Simply navigate to the <code>[dependencies]</code> section of the Cargo.toml, and add the crate and the version, like this example with websocket:
The first method is the simplest, and allows specification of crate versions through a method similar to Ruby gemfiles. Simply navigate to the <code>[dependencies]</code> section of the Cargo.toml, and add the crate and the version, like this example with websocket:  
 
<code>
<code>
[dependencies]
[dependencies]  
...
 
websocket = "0.11.3"
...  
 
websocket = "0.11.3"  
 
</code>
</code>

Revision as of 19:54, 23 March 2015

M1502: Implementing the WebSocket API

This project concentrates on implementing Rust WebSocket API for Mozilla's web browser engine, Servo. The project work involved making the Servo's script depend on WebSocket crate.

Introduction to Mozilla Servo

Servo is a Web Browser engine written in Rust. Servo is an experimental project build that targets new generation of hardware: mobile devices, multi-core processors and high-performance GPUs to obtain power efficiency and maximum parallelism.

Rust

Rust is a Systems programming language built in Rust itself that is fast, memory safe and multithreaded, but does not employ a garbage collector or otherwise impose significant runtime overhead. Rust is able to provide both control over hardware and safety which is not the case with other programming languages like C, C++, Python that provide only either control or safety but not both.

WebSocket

Project Description

The goal of this project was to incorporate the websocket crate in to servo, using the up to date rust websocket crate instructions. To do that, Rust's crate manager and how it interacted with servo's Mach tool was explored.

The Crate Manager

To incorporate new crates in to a project in rust, two main tasks are needed. First, depending on the crate that is used, a dependency needs to be added to the relevant Cargo.toml. For servo and websocket, that Cargo.toml is related to the script component, found in servo's components/script folder. To add a dependency to the Cargo.toml file, a couple different methods are available, both with separate advantages.

The first method is the simplest, and allows specification of crate versions through a method similar to Ruby gemfiles. Simply navigate to the [dependencies] section of the Cargo.toml, and add the crate and the version, like this example with websocket:

[dependencies]

...

websocket = "0.11.3"