Giter VIP home page Giter VIP logo

sunface / rust-by-practice Goto Github PK

View Code? Open in Web Editor NEW
11.1K 70.0 881.0 2.84 MB

Learning Rust By Practice, narrowing the gap between beginner and skilled-dev through challenging examples, exercises and projects.

Home Page: https://practice.rs

License: Creative Commons Attribution 4.0 International

Shell 1.51% Rust 73.55% JavaScript 6.75% Handlebars 16.15% CSS 2.04%
rust practice example exercise examples exercises learning study

rust-by-practice's Introduction

English | 中文

Practice Rust with challenging examples, exercises and projects

Stars Count studyrut LICENSE

This book was designed for easily diving into and getting skilled with Rust It's very easy to use. All you need to do is to make each exercise compile without ERRORS and Panics!

Reading online

Features

Part of our examples and exercises are borrowed from Rust By Example, thanks for your great works!

Although they are so awesome, we have our own secret weapons :)

  • There are three parts in each chapter: examples, exercises and practices

  • Besides examples, we have a lot of exercises, you can Read, Edit and Run them ONLINE

  • Covering nearly all aspects of Rust, such as async/await, threads, sync primitives, optimizing, standard libraries, tool chain, data structures and algorithms etc.

  • Every exercise has its own solutions

  • The overall difficulties are a bit higher and from easy to super hard: easy 🌟 medium 🌟🌟 hard 🌟🌟🌟 super hard 🌟🌟🌟🌟

What we want to do is fill in the gap between learning and getting started with real projects.

🏅 Contributors

Thanks to all of our contributors!


🏆 Special thanks to our English editor:


Tanish-Eagle

Running locally

We use mdbook building our exercises. You can run locally with below steps:

  • Clone the repo
$ git clone [email protected]:sunface/rust-by-practice.git
  • Install mdbook using Cargo
$ cargo install mdbook
  • For Book in English
$ cd rust-by-practice && mdbook serve en/
  • For Book in Chinese
$ cd rust-by-practice && mdbook serve zh-CN/

Some of our exercises

🌟🌟🌟 Tuple struct looks similar to tuples, it has added meaning the struct name provides but has no named fields. It's useful when you want give the whole tuple a name, but don't care the fields's names.

// fix the error and fill the blanks
struct Color(i32, i32, i32);
struct Point(i32, i32, i32);
fn main() {
    let v = Point(___, ___, ___);
    check_color(v);
}

fn check_color(p: Color) {
    let (x, _, _) = p;
    assert_eq!(x, 0);
    assert_eq!(p.1, 127);
    assert_eq!(___, 255);
 }

🌟🌟 Within the destructuring of a single variable, both by-move and by-reference pattern bindings can be used at the same time. Doing this will result in a partial move of the variable, which means that parts of the variable will be moved while other parts stay. In such a case, the parent variable cannot be used afterwards as a whole, however the parts that are only referenced (and not moved) can still be used.

// fix errors to make it work
#[derive(Debug)]
struct File {
    name: String,
    data: String,
}
fn main() {
    let f = File {
        name: String::from("readme.md"),
        data: "Rust By Practice".to_string()
    };

    let _name = f.name;

    // ONLY modify this line
    println!("{}, {}, {:?}",f.name, f.data, f);
}

🌟🌟 A match guard is an additional if condition specified after the pattern in a match arm that must also match, along with the pattern matching, for that arm to be chosen.

// fill in the blank to make the code work, `split` MUST be used
fn main() {
    let num = Some(4);
    let split = 5;
    match num {
        Some(x) __ => assert!(x < split),
        Some(x) => assert!(x >= split),
        None => (),
    }
}

rust-by-practice's People

Contributors

863056768 avatar allendericdalexander avatar chenhai998 avatar chloroplastyu avatar coddeus avatar dongzl avatar emphibian avatar frasbach avatar h3n4l avatar ilovetangy avatar inyourface34456 avatar jacksonutsch avatar katopz avatar maxcrazy1101 avatar mikucy avatar mujeebkalwar avatar mysteryven avatar rupesh-darimisetti avatar skandesh avatar skarlett avatar skaunov avatar skondgekar avatar somoku avatar sunface avatar tanish-eagle avatar wgdzlh avatar xuguangnian avatar zhaoshouhang avatar ziqi-yang avatar zongzi531 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-by-practice's Issues

Partitioning and NAT

Can you add info to the readme about this.

My nodes are all NATed and on dynamic WAN address and so will I presume partition

应用拓扑图

  1. 展示应用之间的访问关系:rpm、错误率、延迟
  2. 应用之间如果访问结果很差,需要通过红色的叉进行标示,表明链路基本断掉了

JVM完善

  1. 增加full gc和perm gen 图表
  2. 图表排列和样式优化

离线节点删除问题

  • 管理员删除
  1. 管理员能看到离线节点的具体离线时间
  2. 当离线时间超过一定阈值时,主动提醒
  3. 管理员根据具体信息进行删除操作
  • 用户删除
  1. 就算用户误删,这种信息也可以重新上报

url 路径优化

  1. UI层统一为 /ui/apm/xx /ui/alerts/xx
  2. Web层统一为/ui/web/xx

从用户角度思考APM的使用

  1. 访问不通了,怎么定位?
  2. 访问延迟高,怎么定位?
  3. 应用内存占用高,怎么定位?
  4. 应用卡,怎么定位?

全链路完善

  1. 耗时怎么做?计算每一个node的独立耗时还是绘制柱形图?
  2. 默认从当前应用展示链路,点击后可以扩展到之前的完整链路
  3. 对每个span的第一个node进行颜色标示,使之更明显
  4. tags要放在二层信息展示还是作为独立的node展示?
  5. 关联到应用指标和系统数据指标
  6. 错误展示
  • 外部的链路点,错误显示为红色
  • 过滤条件增加只查询错误
  • 如果只选择50条,默认取多少条错误点和耗时高的点?需要权衡
  • 链路内部对于错误的node标红显示

API拓扑图

应用可以看到自己的API被哪些应用访问,访问数据展示

链路查询优化

  1. 只查询error链路
  2. 通过api条件过滤
  3. 通过trace_id直接查询

告警平台完善

  1. 为指定接口设定特殊规则
  2. 针对HTTP CODE设定告警规则
  3. 优化命名、代码

应用实时剖析

两种实现选一个

  1. 像老APM一样自己实现
  2. 使用夏光部署的在线诊断工具,iframe嵌入页面

JVM页面

  1. 所有agent信息列表
  2. 单个agent的jvm图表展示

图表时间轴联动

当鼠标查看某张图表的特定点时,其它图表应该联动显示同一个时间轴的点和竖线

image

同一个异常出现两次

&{-1 adsfasdf.dasgfsdf.com} execute(org.apache.http.client.methods.HttpUriRequest request) H2
&{-1 adsfasdf.dasgfsdf.com} open(org.apache.http.conn.routing.HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) H2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.