Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c0c6c895
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0c6c895
编写于
10月 02, 2014
作者:
A
Aaron Turon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Remove the `_` suffix from slice methods."
This reverts commit
df2f1fa7
.
上级
7bf56df4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
97 addition
and
188 deletion
+97
-188
src/libcollections/trie.rs
src/libcollections/trie.rs
+0
-18
src/libcollections/vec.rs
src/libcollections/vec.rs
+0
-53
src/libcore/ops.rs
src/libcore/ops.rs
+10
-41
src/libcore/slice.rs
src/libcore/slice.rs
+69
-58
src/libcoretest/iter.rs
src/libcoretest/iter.rs
+2
-2
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+8
-8
src/test/run-pass/slice.rs
src/test/run-pass/slice.rs
+8
-8
未找到文件。
src/libcollections/trie.rs
浏览文件 @
c0c6c895
...
...
@@ -389,7 +389,6 @@ pub fn iter_mut<'a>(&'a mut self) -> MutEntries<'a, T> {
impl
<
T
>
TrieMap
<
T
>
{
// If `upper` is true then returns upper_bound else returns lower_bound.
#[cfg(stage0)]
#[inline]
fn
bound
<
'a
>
(
&
'a
self
,
key
:
uint
,
upper
:
bool
)
->
Entries
<
'a
,
T
>
{
bound!
(
Entries
,
self
=
self
,
...
...
@@ -397,14 +396,6 @@ fn bound<'a>(&'a self, key: uint, upper: bool) -> Entries<'a, T> {
slice_from
=
slice_from_
,
iter
=
iter
,
mutability
=
)
}
#[cfg(not(stage0))]
#[inline]
fn
bound
<
'a
>
(
&
'a
self
,
key
:
uint
,
upper
:
bool
)
->
Entries
<
'a
,
T
>
{
bound!
(
Entries
,
self
=
self
,
key
=
key
,
is_upper
=
upper
,
slice_from
=
slice_from
,
iter
=
iter
,
mutability
=
)
}
/// Gets an iterator pointing to the first key-value pair whose key is not less than `key`.
/// If all keys in the map are less than `key` an empty iterator is returned.
...
...
@@ -440,7 +431,6 @@ pub fn upper_bound<'a>(&'a self, key: uint) -> Entries<'a, T> {
self
.bound
(
key
,
true
)
}
// If `upper` is true then returns upper_bound else returns lower_bound.
#[cfg(stage0)]
#[inline]
fn
bound_mut
<
'a
>
(
&
'a
mut
self
,
key
:
uint
,
upper
:
bool
)
->
MutEntries
<
'a
,
T
>
{
bound!
(
MutEntries
,
self
=
self
,
...
...
@@ -448,14 +438,6 @@ fn bound_mut<'a>(&'a mut self, key: uint, upper: bool) -> MutEntries<'a, T> {
slice_from
=
slice_from_mut_
,
iter
=
iter_mut
,
mutability
=
mut
)
}
#[cfg(not(stage0))]
#[inline]
fn
bound_mut
<
'a
>
(
&
'a
mut
self
,
key
:
uint
,
upper
:
bool
)
->
MutEntries
<
'a
,
T
>
{
bound!
(
MutEntries
,
self
=
self
,
key
=
key
,
is_upper
=
upper
,
slice_from
=
slice_from_mut
,
iter
=
iter_mut
,
mutability
=
mut
)
}
/// Deprecated: use `lower_bound_mut`.
#[deprecated
=
"use lower_bound_mut"
]
...
...
src/libcollections/vec.rs
浏览文件 @
c0c6c895
...
...
@@ -24,7 +24,6 @@
use
core
::
ops
;
use
core
::
ptr
;
use
core
::
raw
::
Slice
as
RawSlice
;
use
core
::
slice
::
Slice
as
SliceSlice
;
use
core
::
uint
;
use
{
Mutable
,
MutableSeq
};
...
...
@@ -461,36 +460,6 @@ fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
}
}*/
// Annoying helper function because there are two Slice::as_slice functions in
// scope.
#[inline]
fn
slice_to_slice
<
'a
,
T
,
U
:
Slice
<
T
>>
(
this
:
&
'a
U
)
->
&
'a
[
T
]
{
this
.as_slice
()
}
#[cfg(not(stage0))]
impl
<
T
>
ops
::
Slice
<
uint
,
[
T
]
>
for
Vec
<
T
>
{
#[inline]
fn
as_slice
<
'a
>
(
&
'a
self
)
->
&
'a
[
T
]
{
slice_to_slice
(
self
)
}
#[inline]
fn
slice_from
<
'a
>
(
&
'a
self
,
start
:
&
uint
)
->
&
'a
[
T
]
{
slice_to_slice
(
self
)
.slice_from
(
start
)
}
#[inline]
fn
slice_to
<
'a
>
(
&
'a
self
,
end
:
&
uint
)
->
&
'a
[
T
]
{
slice_to_slice
(
self
)
.slice_to
(
end
)
}
#[inline]
fn
slice
<
'a
>
(
&
'a
self
,
start
:
&
uint
,
end
:
&
uint
)
->
&
'a
[
T
]
{
slice_to_slice
(
self
)
.slice
(
start
,
end
)
}
}
#[cfg(stage0)]
impl
<
T
>
ops
::
Slice
<
uint
,
[
T
]
>
for
Vec
<
T
>
{
#[inline]
fn
as_slice_
<
'a
>
(
&
'a
self
)
->
&
'a
[
T
]
{
...
...
@@ -512,28 +481,6 @@ fn slice_<'a>(&'a self, start: &uint, end: &uint) -> &'a [T] {
}
}
#[cfg(not(stage0))]
impl
<
T
>
ops
::
SliceMut
<
uint
,
[
T
]
>
for
Vec
<
T
>
{
#[inline]
fn
as_mut_slice
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
[
T
]
{
self
.as_mut_slice
()
}
#[inline]
fn
slice_from_mut
<
'a
>
(
&
'a
mut
self
,
start
:
&
uint
)
->
&
'a
mut
[
T
]
{
self
.as_mut_slice
()
.slice_from_mut
(
start
)
}
#[inline]
fn
slice_to_mut
<
'a
>
(
&
'a
mut
self
,
end
:
&
uint
)
->
&
'a
mut
[
T
]
{
self
.as_mut_slice
()
.slice_to_mut
(
end
)
}
#[inline]
fn
slice_mut
<
'a
>
(
&
'a
mut
self
,
start
:
&
uint
,
end
:
&
uint
)
->
&
'a
mut
[
T
]
{
self
.as_mut_slice
()
.slice_mut
(
start
,
end
)
}
}
#[cfg(stage0)]
impl
<
T
>
ops
::
SliceMut
<
uint
,
[
T
]
>
for
Vec
<
T
>
{
#[inline]
fn
as_mut_slice_
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
[
T
]
{
...
...
src/libcore/ops.rs
浏览文件 @
c0c6c895
...
...
@@ -688,19 +688,19 @@ pub trait IndexMut<Index, Result> {
* struct Foo;
*
* impl ::core::ops::Slice<Foo, Foo> for Foo {
* fn as_slice<'a>(&'a self) -> &'a Foo {
* fn as_slice
_
<'a>(&'a self) -> &'a Foo {
* println!("Slicing!");
* self
* }
* fn slice_from<'a>(&'a self, from: &Foo) -> &'a Foo {
* fn slice_from
_
<'a>(&'a self, from: &Foo) -> &'a Foo {
* println!("Slicing!");
* self
* }
* fn slice_to<'a>(&'a self, to: &Foo) -> &'a Foo {
* fn slice_to
_
<'a>(&'a self, to: &Foo) -> &'a Foo {
* println!("Slicing!");
* self
* }
* fn slice<'a>(&'a self, from: &Foo, to: &Foo) -> &'a Foo {
* fn slice
_
<'a>(&'a self, from: &Foo, to: &Foo) -> &'a Foo {
* println!("Slicing!");
* self
* }
...
...
@@ -711,22 +711,7 @@ pub trait IndexMut<Index, Result> {
* }
* ```
*/
#[cfg(not(stage0))]
#[lang=
"slice"
]
pub
trait
Slice
<
Idx
,
Sized
?
Result
>
for
Sized
?
{
/// The method for the slicing operation foo[]
fn
as_slice
<
'a
>
(
&
'a
self
)
->
&
'a
Result
;
/// The method for the slicing operation foo[from..]
fn
slice_from
<
'a
>
(
&
'a
self
,
from
:
&
Idx
)
->
&
'a
Result
;
/// The method for the slicing operation foo[..to]
fn
slice_to
<
'a
>
(
&
'a
self
,
to
:
&
Idx
)
->
&
'a
Result
;
/// The method for the slicing operation foo[from..to]
fn
slice
<
'a
>
(
&
'a
self
,
from
:
&
Idx
,
to
:
&
Idx
)
->
&
'a
Result
;
}
/**
*
*/
#[cfg(stage0)]
// FIXME(#17273) remove the postscript _s
#[lang=
"slice"
]
pub
trait
Slice
<
Idx
,
Sized
?
Result
>
for
Sized
?
{
/// The method for the slicing operation foo[]
...
...
@@ -753,19 +738,19 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
* struct Foo;
*
* impl ::core::ops::SliceMut<Foo, Foo> for Foo {
* fn as_mut_slice<'a>(&'a mut self) -> &'a mut Foo {
* fn as_mut_slice
_
<'a>(&'a mut self) -> &'a mut Foo {
* println!("Slicing!");
* self
* }
* fn slice_from_mut<'a>(&'a mut self, from: &Foo) -> &'a mut Foo {
* fn slice_from_mut
_
<'a>(&'a mut self, from: &Foo) -> &'a mut Foo {
* println!("Slicing!");
* self
* }
* fn slice_to_mut<'a>(&'a mut self, to: &Foo) -> &'a mut Foo {
* fn slice_to_mut
_
<'a>(&'a mut self, to: &Foo) -> &'a mut Foo {
* println!("Slicing!");
* self
* }
* fn slice_mut<'a>(&'a mut self, from: &Foo, to: &Foo) -> &'a mut Foo {
* fn slice_mut
_
<'a>(&'a mut self, from: &Foo, to: &Foo) -> &'a mut Foo {
* println!("Slicing!");
* self
* }
...
...
@@ -776,22 +761,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
* }
* ```
*/
#[cfg(not(stage0))]
#[lang=
"slice_mut"
]
pub
trait
SliceMut
<
Idx
,
Sized
?
Result
>
for
Sized
?
{
/// The method for the slicing operation foo[]
fn
as_mut_slice
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
Result
;
/// The method for the slicing operation foo[from..]
fn
slice_from_mut
<
'a
>
(
&
'a
mut
self
,
from
:
&
Idx
)
->
&
'a
mut
Result
;
/// The method for the slicing operation foo[..to]
fn
slice_to_mut
<
'a
>
(
&
'a
mut
self
,
to
:
&
Idx
)
->
&
'a
mut
Result
;
/// The method for the slicing operation foo[from..to]
fn
slice_mut
<
'a
>
(
&
'a
mut
self
,
from
:
&
Idx
,
to
:
&
Idx
)
->
&
'a
mut
Result
;
}
/**
*
*/
#[cfg(stage0)]
// FIXME(#17273) remove the postscript _s
#[lang=
"slice_mut"
]
pub
trait
SliceMut
<
Idx
,
Sized
?
Result
>
for
Sized
?
{
/// The method for the slicing operation foo[mut]
...
...
@@ -803,7 +773,6 @@ pub trait SliceMut<Idx, Sized? Result> for Sized? {
/// The method for the slicing operation foo[mut from..to]
fn
slice_mut_
<
'a
>
(
&
'a
mut
self
,
from
:
&
Idx
,
to
:
&
Idx
)
->
&
'a
mut
Result
;
}
/**
*
* The `Deref` trait is used to specify the functionality of dereferencing
...
...
src/libcore/slice.rs
浏览文件 @
c0c6c895
...
...
@@ -61,6 +61,32 @@
/// Extension methods for immutable slices.
#[unstable
=
"may merge with other traits; region parameter may disappear"
]
pub
trait
ImmutableSlice
<
'a
,
T
>
{
/// Returns a subslice spanning the interval [`start`, `end`).
///
/// Fails when the end of the new slice lies beyond the end of the
/// original slice (i.e. when `end > self.len()`) or when `start > end`.
///
/// Slicing with `start` equal to `end` yields an empty slice.
#[unstable
=
"waiting on final error conventions"
]
//fn slice(&self, start: uint, end: uint) -> &'a [T];
/// Returns a subslice from `start` to the end of the slice.
///
/// Fails when `start` is strictly greater than the length of the original slice.
///
/// Slicing from `self.len()` yields an empty slice.
#[unstable
=
"waiting on final error conventions"
]
// TODO
//fn slice_from(&self, start: uint) -> &'a [T];
/// Returns a subslice from the start of the slice to `end`.
///
/// Fails when `end` is strictly greater than the length of the original slice.
///
/// Slicing to `0` yields an empty slice.
#[unstable
=
"waiting on final error conventions"
]
//fn slice_to(&self, end: uint) -> &'a [T];
/// Divides one slice into two at an index.
///
/// The first will contain all indices from `[0, mid)` (excluding
...
...
@@ -418,35 +444,6 @@ fn pop_ref(&mut self) -> Option<&'a T> {
}
}
#[cfg(not(stage0))]
impl
<
T
>
ops
::
Slice
<
uint
,
[
T
]
>
for
[
T
]
{
#[inline]
fn
as_slice
<
'a
>
(
&
'a
self
)
->
&
'a
[
T
]
{
self
}
#[inline]
fn
slice_from
<
'a
>
(
&
'a
self
,
start
:
&
uint
)
->
&
'a
[
T
]
{
self
.slice
(
start
,
&
self
.len
())
}
#[inline]
fn
slice_to
<
'a
>
(
&
'a
self
,
end
:
&
uint
)
->
&
'a
[
T
]
{
self
.slice
(
&
0
,
end
)
}
#[inline]
fn
slice
<
'a
>
(
&
'a
self
,
start
:
&
uint
,
end
:
&
uint
)
->
&
'a
[
T
]
{
assert
!
(
*
start
<=
*
end
);
assert
!
(
*
end
<=
self
.len
());
unsafe
{
transmute
(
RawSlice
{
data
:
self
.as_ptr
()
.offset
(
*
start
as
int
),
len
:
(
*
end
-
*
start
)
})
}
}
}
#[cfg(stage0)]
impl
<
T
>
ops
::
Slice
<
uint
,
[
T
]
>
for
[
T
]
{
#[inline]
fn
as_slice_
<
'a
>
(
&
'a
self
)
->
&
'a
[
T
]
{
...
...
@@ -474,36 +471,7 @@ fn slice_<'a>(&'a self, start: &uint, end: &uint) -> &'a [T] {
}
}
}
#[cfg(not(stage0))]
impl
<
T
>
ops
::
SliceMut
<
uint
,
[
T
]
>
for
[
T
]
{
#[inline]
fn
as_mut_slice
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
[
T
]
{
self
}
#[inline]
fn
slice_from_mut
<
'a
>
(
&
'a
mut
self
,
start
:
&
uint
)
->
&
'a
mut
[
T
]
{
let
len
=
&
self
.len
();
self
.slice_mut
(
start
,
len
)
}
#[inline]
fn
slice_to_mut
<
'a
>
(
&
'a
mut
self
,
end
:
&
uint
)
->
&
'a
mut
[
T
]
{
self
.slice_mut
(
&
0
,
end
)
}
#[inline]
fn
slice_mut
<
'a
>
(
&
'a
mut
self
,
start
:
&
uint
,
end
:
&
uint
)
->
&
'a
mut
[
T
]
{
assert
!
(
*
start
<=
*
end
);
assert
!
(
*
end
<=
self
.len
());
unsafe
{
transmute
(
RawSlice
{
data
:
self
.as_ptr
()
.offset
(
*
start
as
int
),
len
:
(
*
end
-
*
start
)
})
}
}
}
#[cfg(stage0)]
impl
<
T
>
ops
::
SliceMut
<
uint
,
[
T
]
>
for
[
T
]
{
#[inline]
fn
as_mut_slice_
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
[
T
]
{
...
...
@@ -546,6 +514,49 @@ pub trait MutableSlice<'a, T> {
#[deprecated
=
"use slicing syntax"
]
fn
as_mut_slice
(
self
)
->
&
'a
mut
[
T
];
/// Deprecated: use `slice_mut`.
#[deprecated
=
"use slicing syntax"
]
//fn mut_slice(self, start: uint, end: uint) -> &'a mut [T] {
// self[mut start..end]
//}
/// Returns a mutable subslice spanning the interval [`start`, `end`).
///
/// Fails when the end of the new slice lies beyond the end of the
/// original slice (i.e. when `end > self.len()`) or when `start > end`.
///
/// Slicing with `start` equal to `end` yields an empty slice.
#[unstable
=
"waiting on final error conventions"
]
//fn slice_mut(self, start: uint, end: uint) -> &'a mut [T];
/// Deprecated: use `slicing syntax`.
#[deprecated
=
"use slicing syntax"
]
//fn mut_slice_from(self, start: uint) -> &'a mut [T] {
// self[mut start..]
//}
/// Returns a mutable subslice from `start` to the end of the slice.
///
/// Fails when `start` is strictly greater than the length of the original slice.
///
/// Slicing from `self.len()` yields an empty slice.
#[unstable
=
"waiting on final error conventions"
]
//fn slice_from_mut(self, start: uint) -> &'a mut [T];
/// Deprecated: use `slicing syntax`.
#[deprecated
=
"use slicing syntax"
]
//fn mut_slice_to(self, end: uint) -> &'a mut [T] {
// self[mut ..end]
//}
/// Returns a mutable subslice from the start of the slice to `end`.
///
/// Fails when `end` is strictly greater than the length of the original slice.
///
/// Slicing to `0` yields an empty slice.
#[unstable
=
"waiting on final error conventions"
]
//fn slice_to_mut(self, end: uint) -> &'a mut [T];
/// Deprecated: use `iter_mut`.
#[deprecated
=
"use iter_mut"
]
fn
mut_iter
(
self
)
->
MutItems
<
'a
,
T
>
{
...
...
src/libcoretest/iter.rs
浏览文件 @
c0c6c895
...
...
@@ -373,7 +373,7 @@ fn test_all() {
assert
!
(
v
.iter
()
.all
(|
&
x
|
x
<
10
));
assert
!
(
!
v
.iter
()
.all
(|
&
x
|
x
%
2
==
0
));
assert
!
(
!
v
.iter
()
.all
(|
&
x
|
x
>
100
));
assert
!
(
v
.slice
(
&
0
,
&
0
)
.iter
()
.all
(|
_
|
fail
!
()));
assert
!
(
v
.slice
_
(
&
0
,
&
0
)
.iter
()
.all
(|
_
|
fail
!
()));
}
#[test]
...
...
@@ -382,7 +382,7 @@ fn test_any() {
assert
!
(
v
.iter
()
.any
(|
&
x
|
x
<
10
));
assert
!
(
v
.iter
()
.any
(|
&
x
|
x
%
2
==
0
));
assert
!
(
!
v
.iter
()
.any
(|
&
x
|
x
>
100
));
assert
!
(
!
v
.slice
(
&
0
,
&
0
)
.iter
()
.any
(|
_
|
fail
!
()));
assert
!
(
!
v
.slice
_
(
&
0
,
&
0
)
.iter
()
.any
(|
_
|
fail
!
()));
}
#[test]
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
c0c6c895
...
...
@@ -2271,10 +2271,10 @@ fn try_overloaded_slice(fcx: &FnCtxt,
match
fcx
.tcx
()
.lang_items
.slice_mut_trait
()
{
Some
(
trait_did
)
=>
{
let
method_name
=
match
(
start_expr
,
end_expr
)
{
(
&
Some
(
_
),
&
Some
(
_
))
=>
"slice_mut"
,
(
&
Some
(
_
),
&
None
)
=>
"slice_from_mut"
,
(
&
None
,
&
Some
(
_
))
=>
"slice_to_mut"
,
(
&
None
,
&
None
)
=>
"as_mut_slice"
,
(
&
Some
(
_
),
&
Some
(
_
))
=>
"slice_mut
_
"
,
(
&
Some
(
_
),
&
None
)
=>
"slice_from_mut
_
"
,
(
&
None
,
&
Some
(
_
))
=>
"slice_to_mut
_
"
,
(
&
None
,
&
None
)
=>
"as_mut_slice
_
"
,
};
method
::
lookup_in_trait
(
fcx
,
...
...
@@ -2296,10 +2296,10 @@ fn try_overloaded_slice(fcx: &FnCtxt,
match
fcx
.tcx
()
.lang_items
.slice_trait
()
{
Some
(
trait_did
)
=>
{
let
method_name
=
match
(
start_expr
,
end_expr
)
{
(
&
Some
(
_
),
&
Some
(
_
))
=>
"slice"
,
(
&
Some
(
_
),
&
None
)
=>
"slice_from"
,
(
&
None
,
&
Some
(
_
))
=>
"slice_to"
,
(
&
None
,
&
None
)
=>
"as_slice"
,
(
&
Some
(
_
),
&
Some
(
_
))
=>
"slice
_
"
,
(
&
Some
(
_
),
&
None
)
=>
"slice_from
_
"
,
(
&
None
,
&
Some
(
_
))
=>
"slice_to
_
"
,
(
&
None
,
&
None
)
=>
"as_slice
_
"
,
};
method
::
lookup_in_trait
(
fcx
,
...
...
src/test/run-pass/slice.rs
浏览文件 @
c0c6c895
...
...
@@ -18,38 +18,38 @@
struct
Foo
;
impl
Slice
<
Foo
,
Foo
>
for
Foo
{
fn
as_slice
<
'a
>
(
&
'a
self
)
->
&
'a
Foo
{
fn
as_slice
_
<
'a
>
(
&
'a
self
)
->
&
'a
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
fn
slice_from
<
'a
>
(
&
'a
self
,
_
from
:
&
Foo
)
->
&
'a
Foo
{
fn
slice_from
_
<
'a
>
(
&
'a
self
,
_
from
:
&
Foo
)
->
&
'a
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
fn
slice_to
<
'a
>
(
&
'a
self
,
_
to
:
&
Foo
)
->
&
'a
Foo
{
fn
slice_to
_
<
'a
>
(
&
'a
self
,
_
to
:
&
Foo
)
->
&
'a
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
fn
slice
<
'a
>
(
&
'a
self
,
_
from
:
&
Foo
,
_
to
:
&
Foo
)
->
&
'a
Foo
{
fn
slice
_
<
'a
>
(
&
'a
self
,
_
from
:
&
Foo
,
_
to
:
&
Foo
)
->
&
'a
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
}
impl
SliceMut
<
Foo
,
Foo
>
for
Foo
{
fn
as_mut_slice
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
Foo
{
fn
as_mut_slice
_
<
'a
>
(
&
'a
mut
self
)
->
&
'a
mut
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
fn
slice_from_mut
<
'a
>
(
&
'a
mut
self
,
_
from
:
&
Foo
)
->
&
'a
mut
Foo
{
fn
slice_from_mut
_
<
'a
>
(
&
'a
mut
self
,
_
from
:
&
Foo
)
->
&
'a
mut
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
fn
slice_to_mut
<
'a
>
(
&
'a
mut
self
,
_
to
:
&
Foo
)
->
&
'a
mut
Foo
{
fn
slice_to_mut
_
<
'a
>
(
&
'a
mut
self
,
_
to
:
&
Foo
)
->
&
'a
mut
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
fn
slice_mut
<
'a
>
(
&
'a
mut
self
,
_
from
:
&
Foo
,
_
to
:
&
Foo
)
->
&
'a
mut
Foo
{
fn
slice_mut
_
<
'a
>
(
&
'a
mut
self
,
_
from
:
&
Foo
,
_
to
:
&
Foo
)
->
&
'a
mut
Foo
{
unsafe
{
COUNT
+=
1
;
}
self
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录