Size: a a a

Rust — русскоговорящее сообществo

2020 March 29

EG

Emmanuel Goldstein in Rust — русскоговорящее сообществo
Там чувак парсит ELF через nom
источник

RP

Roman Proskuryakov in Rust — русскоговорящее сообществo
источник

RP

Roman Proskuryakov in Rust — русскоговорящее сообществo
а тут это вообще уже готово
источник

RP

Roman Proskuryakov in Rust — русскоговорящее сообществo
только я где-то встречал крейт, который отказался от гоблина из-за блоата финального бинаря
источник

EG

Emmanuel Goldstein in Rust — русскоговорящее сообществo
sad_snake
Да, сейчас смотрю как раз
И вот эта
https://fasterthanli.me/blog/2019/making-our-own-ping/
А вот в этой части он как раз парсит очень маленькие числа
https://fasterthanli.me/blog/2019/making-our-own-ping-11/
источник

s

sad_snake in Rust — русскоговорящее сообществo
Да, спасибо очень полезно. Сам бы я такое долго откапывал 😊
источник

DS

Dmitry Sokolov in Rust — русскоговорящее сообществo
Что значит
#[macro_use] extern crate lazy_static;
 |              ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
источник

EG

Emmanuel Goldstein in Rust — русскоговорящее сообществo
Dmitry Sokolov
Что значит
#[macro_use] extern crate lazy_static;
 |              ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
Покажи Cargo.toml
источник

EG

Emmanuel Goldstein in Rust — русскоговорящее сообществo
Алсо, в 2018 редакции можно писать
use lazy_static::lazy_static;

вместо этого
источник

s

sad_snake in Rust — русскоговорящее сообществo
Roman Proskuryakov
а тут это вообще уже готово
Это не совсем то
Я просто свой первый rust-проект переписываю заново, раз куча свободного времени. Декодировать инструкции x86, mips, arc итд
источник

DS

Dmitry Sokolov in Rust — русскоговорящее сообществo
Emmanuel Goldstein
Покажи Cargo.toml
добавил эту зависимость в cargo.toml
появилось куча других ошибок
error[E0432]: unresolved imports hyper::server::Request, hyper::server::Response
 --> src\main.rs:10:21
  |
10 | use hyper::server::{Request, Response};
  |                     ^^^^^^^  ^^^^^^^^ no Response in server
  |                     |
  |                     no Request in server

error[E0433]: failed to resolve: could not find uri in hyper
 --> src\main.rs:12:12
  |
12 | use hyper::uri::RequestUri::{AbsolutePath};
  |            ^^^ could not find uri in hyper

error[E0432]: unresolved import hyper::net
 --> src\main.rs:11:12
  |
11 | use hyper::net::Fresh;
  |            ^^^ could not find net in hyper

error[E0531]: cannot find tuple struct or tuple variant AbsolutePath in this scope
 --> src\main.rs:20:9
  |
20 |         AbsolutePath(ref path) => match (&req.method, &path[..]) {
  |         ^^^^^^^^^^^^ not found in this scope

error[E0531]: cannot find unit struct, unit variant or constant Get in crate hyper
 --> src\main.rs:21:22
  |
21 |             (&hyper::Get, "/") => {
  |                      ^^^ not found in hyper

error[E0425]: cannot find value NotFound in crate hyper
 --> src\main.rs:47:32
  |
47 |     *res.status_mut() = hyper::NotFound;
  |                                ^^^^^^^^ not found in hyper
  |
help: possible candidate is found in another module, you can import it into scope
  |
6  | use std::io::ErrorKind::NotFound;
  |

error[E0599]: no method named at found for struct regex::Captures<'_> in the current scope
 --> src\main.rs:42:42
  |
42 |     r.write_all(format!("Hello, {}", cap.at(1).unwrap()).as_bytes()).unwrap();
  |                                          ^^ method not found in regex::Captures<'_>

error[E0599]: no function or associated item named http found for struct hyper::Server<_, _, _> in the current scope
 --> src\main.rs:53:21
  |
53 |     let _ = Server::http("127.0.0.1:3000").unwrap().handle(handler);
  |                     ^^^^ function or associated item not found in hyper::Server<_, _, _>

warning: unused import: std::io::Write
--> src\main.rs:6:5
 |
6 | use std::io::Write;
 |     ^^^^^^^^^^^^^^
 |
 = note: #[warn(unused_imports)] on by default

error: aborting due to 8 previous errors

похоже код нужно переписывать
источник

EG

Emmanuel Goldstein in Rust — русскоговорящее сообществo
Dmitry Sokolov
добавил эту зависимость в cargo.toml
появилось куча других ошибок
error[E0432]: unresolved imports hyper::server::Request, hyper::server::Response
 --> src\main.rs:10:21
  |
10 | use hyper::server::{Request, Response};
  |                     ^^^^^^^  ^^^^^^^^ no Response in server
  |                     |
  |                     no Request in server

error[E0433]: failed to resolve: could not find uri in hyper
 --> src\main.rs:12:12
  |
12 | use hyper::uri::RequestUri::{AbsolutePath};
  |            ^^^ could not find uri in hyper

error[E0432]: unresolved import hyper::net
 --> src\main.rs:11:12
  |
11 | use hyper::net::Fresh;
  |            ^^^ could not find net in hyper

error[E0531]: cannot find tuple struct or tuple variant AbsolutePath in this scope
 --> src\main.rs:20:9
  |
20 |         AbsolutePath(ref path) => match (&req.method, &path[..]) {
  |         ^^^^^^^^^^^^ not found in this scope

error[E0531]: cannot find unit struct, unit variant or constant Get in crate hyper
 --> src\main.rs:21:22
  |
21 |             (&hyper::Get, "/") => {
  |                      ^^^ not found in hyper

error[E0425]: cannot find value NotFound in crate hyper
 --> src\main.rs:47:32
  |
47 |     *res.status_mut() = hyper::NotFound;
  |                                ^^^^^^^^ not found in hyper
  |
help: possible candidate is found in another module, you can import it into scope
  |
6  | use std::io::ErrorKind::NotFound;
  |

error[E0599]: no method named at found for struct regex::Captures<'_> in the current scope
 --> src\main.rs:42:42
  |
42 |     r.write_all(format!("Hello, {}", cap.at(1).unwrap()).as_bytes()).unwrap();
  |                                          ^^ method not found in regex::Captures<'_>

error[E0599]: no function or associated item named http found for struct hyper::Server<_, _, _> in the current scope
 --> src\main.rs:53:21
  |
53 |     let _ = Server::http("127.0.0.1:3000").unwrap().handle(handler);
  |                     ^^^^ function or associated item not found in hyper::Server<_, _, _>

warning: unused import: std::io::Write
--> src\main.rs:6:5
 |
6 | use std::io::Write;
 |     ^^^^^^^^^^^^^^
 |
 = note: #[warn(unused_imports)] on by default

error: aborting due to 8 previous errors

похоже код нужно переписывать
А hyper у тебя есть в Cargo.toml?
источник

EG

Emmanuel Goldstein in Rust — русскоговорящее сообществo
Если да, то какой версии
источник

DS

Dmitry Sokolov in Rust — русскоговорящее сообществo
последней, a коду где-то несколько лет
источник

V

Vladimir in Rust — русскоговорящее сообществo
За такой метод публикации логов нужно бить плетью, как мне кажется
источник

V

Vladimir in Rust — русскоговорящее сообществo
Для кого создали pastebin, а потом и hastebin?
источник

🦉⁣

🦉 ⁣ in Rust — русскоговорящее сообществo
Dmitry Sokolov
добавил эту зависимость в cargo.toml
появилось куча других ошибок
error[E0432]: unresolved imports hyper::server::Request, hyper::server::Response
 --> src\main.rs:10:21
  |
10 | use hyper::server::{Request, Response};
  |                     ^^^^^^^  ^^^^^^^^ no Response in server
  |                     |
  |                     no Request in server

error[E0433]: failed to resolve: could not find uri in hyper
 --> src\main.rs:12:12
  |
12 | use hyper::uri::RequestUri::{AbsolutePath};
  |            ^^^ could not find uri in hyper

error[E0432]: unresolved import hyper::net
 --> src\main.rs:11:12
  |
11 | use hyper::net::Fresh;
  |            ^^^ could not find net in hyper

error[E0531]: cannot find tuple struct or tuple variant AbsolutePath in this scope
 --> src\main.rs:20:9
  |
20 |         AbsolutePath(ref path) => match (&req.method, &path[..]) {
  |         ^^^^^^^^^^^^ not found in this scope

error[E0531]: cannot find unit struct, unit variant or constant Get in crate hyper
 --> src\main.rs:21:22
  |
21 |             (&hyper::Get, "/") => {
  |                      ^^^ not found in hyper

error[E0425]: cannot find value NotFound in crate hyper
 --> src\main.rs:47:32
  |
47 |     *res.status_mut() = hyper::NotFound;
  |                                ^^^^^^^^ not found in hyper
  |
help: possible candidate is found in another module, you can import it into scope
  |
6  | use std::io::ErrorKind::NotFound;
  |

error[E0599]: no method named at found for struct regex::Captures<'_> in the current scope
 --> src\main.rs:42:42
  |
42 |     r.write_all(format!("Hello, {}", cap.at(1).unwrap()).as_bytes()).unwrap();
  |                                          ^^ method not found in regex::Captures<'_>

error[E0599]: no function or associated item named http found for struct hyper::Server<_, _, _> in the current scope
 --> src\main.rs:53:21
  |
53 |     let _ = Server::http("127.0.0.1:3000").unwrap().handle(handler);
  |                     ^^^^ function or associated item not found in hyper::Server<_, _, _>

warning: unused import: std::io::Write
--> src\main.rs:6:5
 |
6 | use std::io::Write;
 |     ^^^^^^^^^^^^^^
 |
 = note: #[warn(unused_imports)] on by default

error: aborting due to 8 previous errors

похоже код нужно переписывать
.
источник

p

polunin.ai in Rust — русскоговорящее сообществo
sad_snake
Тогда просто придеться городить неприятные конструкции, если нужно резать на меньшие куски, чем помещается в u8
Ничего сложного конечно, но зачем?
Мне кажется или ты экономишь биты? Насколько это целеоправданно?
источник

ML

Mike Lubinets in Rust — русскоговорящее сообществo
sad_snake
Тогда просто придеться городить неприятные конструкции, если нужно резать на меньшие куски, чем помещается в u8
Ничего сложного конечно, но зачем?
Как можно нарезать на меньшие куски, когда минимальная адресуется единица -- байт?
источник

s

sad_snake in Rust — русскоговорящее сообществo
Mike Lubinets
Как можно нарезать на меньшие куски, когда минимальная адресуется единица -- байт?
Занулить остальные 🤷‍♂
источник