Skip to content

Commit dbdc51a

Browse files
authored
Update exotic-sizes.md
1 parent ab4ea5c commit dbdc51a

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/exotic-sizes.md

+6-13
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,20 @@
1515

1616
트레잇 객체는 그것이 특정하는 트레잇을 구현하는 어떤 타입을 표현합니다. 정확한 원래 타입은 런타임 리플렉션을 위해 *지워지고,* 타입을 쓰기 위해 필요한 모든 정보를 담고 있는 vtable로 대체됩니다. 트레잇 객체를 완성하는 정보는 이 vtable의 포인터입니다. 포인터가 가리키는 대상의 런타임 크기는 vtable에서 동적으로 요청될 수 있습니다.
1717

18+
슬라이스는 어떤 연속적인 저장소에 대한 뷰일 뿐입니다 -- 보통 이 저장소는 배열이거나 `Vec`입니다. 슬라이스 포인터를 완성시키는 정보는 가리키고 있는 원소들의 갯수입니다.
19+
가리키는 대상의 런타임 크기는 그냥 한 원소의 정적으로 알려진 크기와 원소들의 갯수를 곱한 것입니다.
1820

19-
20-
A slice is simply a view into some contiguous storage -- typically an array or
21-
`Vec`. The information that completes a slice pointer is just the number of elements
22-
it points to. The runtime size of the pointee is just the statically known size
23-
of an element multiplied by the number of elements.
24-
25-
Structs can actually store a single DST directly as their last field, but this
26-
makes them a DST as well:
21+
구조체는 사실 마지막 필드로써 하나의 동량 타입을 직접 저장할 수 있지만, 그러면 그들 자신도 동량 타입이 됩니다:
2722

2823
```rust
29-
// Can't be stored on the stack directly
24+
// 직접적으로 스택에 저장할 수 없음
3025
struct MySuperSlice {
3126
info: u32,
3227
data: [u8],
3328
}
3429
```
3530

36-
Although such a type is largely useless without a way to construct it. Currently the
37-
only properly supported way to create a custom DST is by making your type generic
38-
and performing an *unsizing coercion*:
31+
이런 타입은 생성할 방법이 없으면 별로 쓸모가 없지만 말이죠. 현재 유일하게 제대로 지원되는, 커스텀 동량 타입을 만들 방법은 타입을 제네릭으로 만들고 *크기 강제 망각*을 실행하는 것입니다:
3932

4033
```rust
4134
struct MySuperSliceable<T: ?Sized> {
@@ -56,7 +49,7 @@ fn main() {
5649
}
5750
```
5851

59-
(Yes, custom DSTs are a largely half-baked feature for now.)
52+
(네, 커스텀 동량 타입은 지긍으로써는 매우 설익은 기능입니다.)
6053

6154
## Zero Sized Types (ZSTs)
6255

0 commit comments

Comments
 (0)