Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anonymousGiga/learn_rust
/ functions
Functions
204 in github.com/anonymousGiga/learn_rust
⨍
Functions
204
◇
Types & classes
71
↓ 6 callers
Method
next
(&mut self)
learn_iter2/src/main.rs:13
↓ 4 callers
Method
prin
(&self)
learn_enum/src/main.rs:43
↓ 4 callers
Method
prin
(&self)
learn_enum2/src/main.rs:18
↓ 3 callers
Method
add
(&mut self, value: i32)
learn_oo1/getaver/src/lib.rs:14
↓ 3 callers
Function
produce_re
()
learn_crate2/mylib/src/factory.rs:2
↓ 2 callers
Function
add_counter
(inc: u32)
learn_unsafe5/src/main.rs:14
↓ 2 callers
Method
get_school_name
(&self)
learn_trait1/src/main.rs:41
↓ 2 callers
Function
largest
fn largest<T: PartialOrd + Copy> (list: &[T]) -> T {
learn_trait3/src/main.rs:2
↓ 2 callers
Function
plus_one
(x: Option<i32>)
learn_option/src/main.rs:44
↓ 2 callers
Function
print_information
4、默认实现:可以在定义trait的时候提供默认的行为,trait的类型可以使用默认的行为。 5、trait作为参数
learn_trait1/src/main.rs:58
↓ 2 callers
Function
show
(arr:[u32;3])
learn_type/src/main.rs:51
↓ 2 callers
Method
tail
(&self)
learn_loop_ref2/src/main.rs:9
↓ 2 callers
Method
update_average
(&mut self)
learn_oo1/getaver/src/lib.rs:34
↓ 2 callers
Method
value
(&mut self, arg: u32)
learn_closure2/src/main.rs:19
↓ 2 callers
Function
wapper_func
(t: T, v: i32)
learn_hfn1/src/main.rs:12
↓ 1 callers
Function
add_one
(x: i32)
addr/add-one/src/lib.rs:1
↓ 1 callers
Function
add_one_v1
语法格式
learn_closure1/src/main.rs:39
↓ 1 callers
Method
creat_point
(self, other: Point2<V, W>)
learn_T/src/main.rs:115
↓ 1 callers
Function
dangerous
5、调用不安全的函数或者方法
learn_unsafe2/src/main.rs:2
↓ 1 callers
Function
dangle
()
learn_ref2/src/main.rs:8
↓ 1 callers
Function
do_twice
(f: fn(i32) -> i32, val: i32)
learn_hfn1/src/main.rs:8
↓ 1 callers
Method
draw
(&self)
learn_oo2/gui/src/lib.rs:40
↓ 1 callers
Function
foo
()
learn_unsafe4/foo/src/lib.rs:3
↓ 1 callers
Function
foo
()
learn_unsafe2/src/main.rs:6
↓ 1 callers
Method
foo
(&self)
learn_unsafe6/src/main.rs:11
↓ 1 callers
Function
function
(x: &'a str, y: &'a str, ann: T)
learn_life5/src/main.rs:9
↓ 1 callers
Function
get_a_str
2、生命周期省略
learn_life3/src/main.rs:18
↓ 1 callers
Function
get_str
(x: &'a str, y: &str)
learn_life2/src/main.rs:12
↓ 1 callers
Function
hello
(name: &str)
learn_deref1/src/main.rs:29
↓ 1 callers
Function
impl_hello_macro
(ast: &syn::DeriveInput)
learn_macro2/hello_macro/hello_macro_derive/src/lib.rs:6
↓ 1 callers
Function
longest
函数中的生命周期 fn longest(x: &str, y: &str) -> &str { fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
learn_life2/src/main.rs:4
↓ 1 callers
Function
makes_copy
(i: i32)
learn_fn2/src/main.rs:6
↓ 1 callers
Function
other_fun
()
learn_fn/src/main.rs:1
↓ 1 callers
Function
other_fun1
(a: i32, b: u32)
learn_fn/src/main.rs:5
↓ 1 callers
Function
other_fun2
(a: i32, b: i32)
learn_fn/src/main.rs:10
↓ 1 callers
Function
other_fun3
(a: i32, b: i32)
learn_fn/src/main.rs:15
↓ 1 callers
Function
print_B
()
learn_crate3/src/main.rs:22
↓ 1 callers
Function
print_C
()
learn_crate3/src/main.rs:27
↓ 1 callers
Method
print_a
(&self)
learn_crate3/src/main.rs:16
↓ 1 callers
Method
print_all_information
(&self)
learn_trait4/src/main.rs:13
↓ 1 callers
Function
print_information
写法二:
learn_trait2/src/main.rs:25
↓ 1 callers
Method
print_name
(&self)
learn_trait5/src/main.rs:11
↓ 1 callers
Method
print_name
(&self)
learn_oo/src/main.rs:11
↓ 1 callers
Function
print_point
函数 函数的参数也是模式
learn_pattern/src/main.rs:83
↓ 1 callers
Function
produce_item_with_age
()
learn_trait2/src/main.rs:50
↓ 1 callers
Function
produce_re
()
learn_crate/src/main.rs:3
↓ 1 callers
Function
read_username_from_file
()
learn_err2/src/main.rs:43
↓ 1 callers
Method
remove
(&mut self)
learn_oo1/getaver/src/lib.rs:19
↓ 1 callers
Function
return_clo
()
learn_hfn2/src/main.rs:6
↓ 1 callers
Method
run
(&self)
learn_oo2/gui/src/lib.rs:17
↓ 1 callers
Method
tail
(&self)
learn_loop_ref/src/main.rs:8
↓ 1 callers
Function
takes_ownership
(some_string: String)
learn_fn2/src/main.rs:1
Method
add
(self, other: Point)
learn_htrait2/src/main.rs:16
Function
add_one
1、函数指针 函数指针允许我们使用函数作为另一个函数的参数。 函数的类型是 fn ,fn 被称为 函数指针。指定参数为函数指针的语法类似于闭包。
learn_hfn1/src/main.rs:4
Function
add_one
My Crate 'my_crate' is a collection of utilites to make performing certain calcuations more convenient Add one to the number given #Example ``` le
learn_crate1/mylib/src/lib.rs:14
Method
average
(&self)
learn_oo1/getaver/src/lib.rs:30
Method
baby_name
()
learn_htrait3/src/main.rs:44
Function
calcute_length
fn main() { let s1 = gives_ownership(); println!("s1 = {}", s1); let mut s2 = String::from("hello"); let s3 = takes_and_gives_back(s2); s2 = takes_an
learn_ref/src/main.rs:24
Method
deref
(&self)
learn_deref1/src/main.rs:12
Method
do_something
(&self)
learn_life4/src/main.rs:7
Method
do_something2
(&self, s: &str)
learn_life4/src/main.rs:11
Method
do_something3
(&self, s: &'a str)
learn_life4/src/main.rs:16
Method
drop
(&mut self)
learn_drop/src/main.rs:9
Method
drop
(&mut self)
learn_drop1/src/main.rs:6
Method
fmt
(&self, f: &mut fmt::Formatter)
learn_htrait5/src/main.rs:8
Method
fmt
(&self, f: &mut fmt::Formatter)
learn_htrait4/src/main.rs:22
Function
func
(v: i32)
learn_hfn1/src/main.rs:17
Method
get_age
(&self)
learn_trait4/src/main.rs:34
Method
get_age
(&self)
learn_trait2/src/main.rs:45
Method
get_age
(&self)
learn_trait1/src/main.rs:29
Method
get_height
(&self)
learn_stu2/src/main.rs:27
Method
get_name
(&self)
learn_trait4/src/main.rs:28
Method
get_name
(&self)
learn_trait5/src/main.rs:21
Method
get_name
(&self)
learn_stu2/src/main.rs:9
Method
get_name
(&self)
learn_trait2/src/main.rs:39
Method
get_name
(&self)
learn_trait1/src/main.rs:25
Method
get_school_name
(&self)
learn_trait1/src/main.rs:11
Method
get_weight
(&self)
learn_stu2/src/main.rs:13
Method
get_x
(&self)
learn_T/src/main.rs:100
Method
get_y
(&self)
learn_T/src/main.rs:104
Function
hello
()
learn_test/mylib/src/animal.rs:2
Function
hello_macro_derive
(input: TokenStream)
learn_macro2/hello_macro/hello_macro_derive/src/lib.rs:20
Function
is_cat
()
learn_test/mylib/src/animal.rs:16
Function
is_dog
()
learn_test/mylib/src/animal.rs:6
Function
it_works
()
learn_crate2/mylib/src/lib.rs:6
Function
it_works
()
learn_macro1/mac/src/lib.rs:17
Function
it_works
()
learn_oo2/gui/src/lib.rs:62
Function
it_works
()
learn_test/mylib/src/lib.rs:10
Function
it_works
()
addr/add-one/src/lib.rs:8
Function
it_works
()
learn_macro2/hello_macro/src/lib.rs:8
Function
it_works
()
learn_macro2/hello_macro/hello_macro_derive/src/lib.rs:28
Function
it_works
()
learn_oo1/getaver/src/lib.rs:42
Function
main
()
learn_crate2/src/main.rs:8
Function
main
()
learn_weak1/src/main.rs:11
Function
main
()
learn_trait4/src/main.rs:56
Function
main
1、Rust中每一个引用都有其生命周期,也就是引用保持有效的作用域。大部分时候生命周期是隐含并可以推断的,正如大部分时候类型可以推断一样。 2、生命周期的主要目标是避免悬垂引用。 3、Rust编译器使用借用检查器来检查生命周期是否有效。
learn_life1/main.rs:6
Function
main
1、Rust中每一个引用都有其生命周期,也就是引用保持有效的作用域。大部分时候生命周期是隐含并可以推断的,正如大部分时候类型可以推断一样。 2、生命周期的主要目标是避免悬垂引用。 3、Rust编译器使用借用检查器来检查生命周期是否有效。
learn_life1/src/main.rs:6
Function
main
()
learn_pattern7/src/main.rs:31
Function
main
()
learn_deref/src/main.rs:6
Function
main
3、动态大小类型和Sized trait 动态大小类型(dynamically sized types),有时被称为 “DST” 或 “unsized types”, 这些类型允许我们处理只有在运行时才知道大小的类型。 (1)最典型的就是str
learn_htype3/src/main.rs:5
next →
1–100 of 204, ranked by callers