Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/daheige/rust-bible
/ functions
Functions
416 in github.com/daheige/rust-bible
⨍
Functions
416
◇
Types & classes
143
↓ 1 callers
Function
parse_descriptor_proto
()
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:432
↓ 1 callers
Method
poll
(self: Pin<&mut Self>, cx: &mut Context<'_>)
part4/async-tokio-demo/src/main.rs:159
↓ 1 callers
Method
print
(&self)
part1/compound_type/src/main.rs:274
↓ 1 callers
Function
print_app_info
part8/cc-demo/src/foo.c:7
↓ 1 callers
Function
print_async
()
part1/async_await/src/main.rs:70
↓ 1 callers
Method
print_name
&self作为第一个参数,表示借用self,只读,不获取self的所有权
part1/compound_type/src/main.rs:31
↓ 1 callers
Function
prompt
(s: &str)
part8/cc-demo/src/main.rs:35
↓ 1 callers
Function
race_tasks
()
part4/async-future-demo/src/main.rs:54
↓ 1 callers
Function
read_file
异步读取文件内容
part4/async-std-demo/src/main.rs:4
↓ 1 callers
Function
read_file
()
part1/error_handler/src/main.rs:33
↓ 1 callers
Function
read_file2
通过?来简化错误处理 者通过使用运算符“?”将错误传递给程序调用方 Rust 的错误处理方式是显式的:允许失败的操作通过 Result 或 Option 泛型返回两个部分的值
part1/result_demo/src/main.rs:38
↓ 1 callers
Function
read_file3
可以?链式调用处理,当遇到错误就会终止,立即返回错误error ?消除来大量样板代码,使得函数处理错误更加简单,它会自动给处理错误返回 ? 只能被用于返回的Result的函数处理
part1/error_handler/src/main.rs:61
↓ 1 callers
Method
ref_cell
(self)
part1/cell_demo/src/main.rs:68
↓ 1 callers
Function
request_block_v1
Blocking Client 阻塞的方式请求
part1/reqwest-demo/src/main.rs:18
↓ 1 callers
Function
root
basic handler that responds with a static string 返回一个静态的字符串字面量
part5/axum-demo/src/main.rs:47
↓ 1 callers
Function
say
在async函数中执行另一个异步调用 通过同步代码的顺序实现了异步的执行效果
part4/futures-demo/src/main.rs:14
↓ 1 callers
Function
say
(name: &str)
part1/my-mod2/src/front/hosting.rs:1
↓ 1 callers
Function
say_hello
由于 async 会返回一个 Future,因此我们还需要配合使用 .await 来让该 Future 运行起来
part4/time-future/src/main.rs:7
↓ 1 callers
Function
say_hello
()
part8/mylib/src/lib.rs:4
↓ 1 callers
Function
say_hello
()
part7/job/cron-demo/src/main.rs:30
↓ 1 callers
Function
say_hello
(s:&str)
part1/borrwer/src/main.rs:58
↓ 1 callers
Method
say_hello
(&self, o: ::grpc::RequestOptions, req: super::hello::HelloReq)
part7/grpc/grpc-hello/src/rust_grpc/hello_grpc.rs:43
↓ 1 callers
Method
say_hello
( &mut self, request: impl tonic::IntoRequest<super::HelloReq>, )
part7/grpc/grpc-demo/src/rust_grpc/app.grpc.hello.rs:85
↓ 1 callers
Function
say_to_world
()
part4/async-tokio-demo/src/main.rs:11
↓ 1 callers
Function
ser_point
序列化point 通过serde_json::Result返回结果
part2/serde_demo/src/main.rs:15
↓ 1 callers
Method
set_message
Param is passed by value, moved
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:278
↓ 1 callers
Method
set_name
Param is passed by value, moved
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:73
↓ 1 callers
Method
set_num
(&mut self, number: &'a i64)
part1/memory/lifetime/src/main.rs:56
↓ 1 callers
Function
show_me
将trait object作为函数的参数使用,属于动态分发处理 这里将特征对象传递给函数
part1/trait_object/src/main.rs:33
↓ 1 callers
Function
show_me
区间内泛型 这是在泛型元素上指定特征区间的最常用语法。 下面代码中的 show_me 函数是指定特 征区间的一种方法,它会接收任何实现了 Display 特征的类型。 这是在泛型函数的类型签名的长度较短时声明特征区间的常见语法。
part1/trait_bound/src/intro.rs:51
↓ 1 callers
Function
show_me
特征对象通过dyn trait name来进行特征分发 可以创建多态api,这种方式被声明为实现了某个特征api,就是特征对象 特征对象实现实际上一个胖指针,并且是不定长类型,需要在引用符号后面使用 在运行时候,才知道具体的trait是什么类型实现的
part1/generics_trait_lifetime/src/main.rs:144
↓ 1 callers
Function
shutdown
graceful shutdown
part5/axum-demo/src/main.rs:91
↓ 1 callers
Function
sing_song
(name: String)
part4/async-future-demo/src/main.rs:19
↓ 1 callers
Method
sleep
(&self)
part1/trait_bound/src/intro.rs:107
↓ 1 callers
Function
sort_from_cpp
(arr: &mut [i32])
part8/cc-cpp-demo/src/main.rs:7
↓ 1 callers
Function
take_ownership
(s : String)
part1/borrwer/src/main.rs:62
↓ 1 callers
Function
take_the_n
函数参数可变借用(可变引用)
part1/borrwer/src/main.rs:53
↓ 1 callers
Function
takes_and_give_back
s的所有权会移动到函数内部中,所以这里将s重新进行了返回处理 将s的所有权转移到了函数里面,然后又返回了s 新变量
part1/owner_ship/src/main.rs:70
↓ 1 callers
Function
task_one
select! 宏操作 随机运行任意一个future
part4/async-future-demo/src/main.rs:46
↓ 1 callers
Function
task_two
()
part4/async-future-demo/src/main.rs:50
↓ 1 callers
Function
try_main
(addr: impl ToSocketAddrs)
part4/a-chat/src/client.rs:17
↓ 1 callers
Method
write_date
(&self)
part6/inject-demo/src/main.rs:29
Method
accept_gzip
(mut self)
part7/grpc/grpc-demo/src/rust_grpc/app.grpc.hello.rs:81
Method
accept_gzip
(mut self)
part7/grpc/grpc-demo/src/rust_grpc/hello.rs:80
Function
add
(a: i64, b: i64)
part5/actix-web-demo/src/main.rs:32
Function
add
定义函数,->表示返回的标志,返回结果是一个i32类型 x,y后面的: 接着指定类型
part1/variables/src/main.rs:95
Function
add
(x:i32,y:i32)
part1/unit_test/src/main.rs:5
Function
add
函数定义关键字fn,返回值通过->来定义
part1/compound_type/src/main.rs:227
Function
add
(a: i64, b: i64)
part1/hello_world/src/main.rs:20
Method
area
方法的第一个参数必须有一个名为 self 的Self 类型的参数 所以 Rust 让你在第一个参数位置上只用 self 这个名字来缩写 我们仍然需要在 self 前面使用 & 来表示这个方法借用了 Self 实例 借用实例,不拥有所有权,只读访问Self 我们并不想获取所有权,只希望能够读取结构体
part1/struct_demo/src/main.rs:30
Method
as_any
(&self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:154
Method
as_any_mut
(&mut self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:157
Function
async_song
()
part1/async_await/src/main.rs:87
Function
async_test
()
part1/async_await/src/main.rs:80
Function
box_test
()
part1/ref_var/src/main.rs:79
Function
cal
元组在函数返回值场景很常用,例如下面的代码,可以使用元组返回多个值:
part1/compound_type/src/main.rs:233
Function
cal_len
引用,是只读引用,拿来用下,但是不转移所有权 & 符号就是 引用,它们允许你使用值但不获取其所有权 因为并不拥有这个值,所以当引用停止使用时,它所指向的值也不会被丢弃。 创建一个引用的行为称为 借用(borrowing)。 正如现实生活中,如果一个人拥有某样东西,你可以从他那里借来。当你使用完毕,必
part1/owner_ship/src/main.rs:79
Method
call
(&mut self, req: http::Request<B>)
part7/grpc/grpc-demo/src/rust_grpc/app.grpc.hello.rs:163
Method
call
(&mut self, req: http::Request<B>)
part7/grpc/grpc-demo/src/rust_grpc/hello.rs:162
Function
call_next_directly
()
part1/iterators/src/main.rs:80
Method
clear_id
(&mut self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:53
Method
clear_message
(&mut self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:273
Method
clear_name
(&mut self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:68
Function
closure_demo
()
part1/closures/src/main.rs:187
Method
compute_size
(&self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:118
Function
config_log_output
()
part2/logger/src/main.rs:34
Method
connect
Attempt to create a new client by connecting to a given endpoint.
part7/grpc/grpc-demo/src/rust_grpc/app.grpc.hello.rs:31
Function
create_user
body request 自动反序列化为payload,它的类型是User
part5/axum-demo/src/main.rs:64
Function
create_user
接收json格式,自动序列化为CreateUserReq格式
part7/web/rs-api/src/router/api.rs:36
Function
dead_end
()
part1/variables/src/main.rs:104
Method
default
()
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:37
Method
default_instance
()
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:194
Method
describe
(&self)
part1/generics_trait_lifetime/src/main.rs:224
Method
describe
(&self)
part1/generics_trait_lifetime/src/main.rs:237
Method
descriptor
(&self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:164
Method
descriptor_static
()
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:172
Method
deserialize_message
(payload: &Payload)
part3/pulsar-consumer/src/main.rs:25
Method
deserialize_message
(payload: &Payload)
part3/pulsar-batch/src/main.rs:40
Method
display
(&self)
part1/generics_trait_lifetime/src/main.rs:77
Function
double
(val: usize)
part1/map_option_result/src/main.rs:10
Method
eat
(&self)
part1/trait_bound/src/intro.rs:95
Function
either
Returning different response types http://localhost:3000/either?id=2&name=daheige
part7/web/rs-api/src/router/api.rs:47
Function
first_word
省略生命周期的场景,借用检查器可以自行推断生命周期
part1/generics_trait_lifetime/src/main.rs:413
Method
fmt
(&self, f: &mut ::std::fmt::Formatter<'_>)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:209
Method
fmt
(&self, f: &mut std::fmt::Formatter<'_>)
part7/grpc/grpc-demo/src/rust_grpc/app.grpc.hello.rs:233
Method
fmt
(&self, f: &mut std::fmt::Formatter<'_>)
part7/grpc/grpc-demo/src/rust_grpc/hello.rs:232
Function
foo
(mut req: Request<()>)
part5/tide-demo/src/main.rs:97
Function
forever
一个用不退出的loop循环
part1/variables/src/main.rs:109
Function
form2
当请求http://localhost:3000/form2?name=111&email= 会提示:Input validation error: [email: email can not be empty]
part5/axum-demo/src/main.rs:169
Method
from_arc
(inner: Arc<T>)
part7/grpc/grpc-demo/src/rust_grpc/app.grpc.hello.rs:130
Method
from_arc
(inner: Arc<T>)
part7/grpc/grpc-demo/src/rust_grpc/hello.rs:129
Method
from_request
(req: &mut RequestParts<B>)
part5/axum-demo/src/main.rs:185
Method
get_area
(&self)
part1/trait_object/src/main.rs:20
Method
get_cached_size
(&self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:142
Function
get_cookie
(req: Request<()>)
part5/tide-demo/src/main.rs:173
Method
get_fruit
(&self)
part1/my-mod/src/main.rs:17
Method
get_id
(&self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:50
Function
get_index
()
part5/actix-web-demo/src/main.rs:48
Method
get_message
(&self)
part7/grpc/grpc-hello/src/rust_grpc/hello.rs:270
Function
get_name
从path获取参数
part5/tide-demo/src/main.rs:105
← previous
next →
101–200 of 416, ranked by callers