Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add some array usage examples #26814

Merged
merged 1 commit into from Jul 9, 2015
Merged

doc: add some array usage examples #26814

merged 1 commit into from Jul 9, 2015

Conversation

tshepang
Copy link
Member

@tshepang tshepang commented Jul 5, 2015

No description provided.

@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@bluss
Copy link
Member

bluss commented Jul 9, 2015

Looks good. Isn't this a nice place to explain how certain traits are implemented just for array sizes 0-32? Maybe mention information that's not visible in the API documentation:

  • [T; N] is an array type for any compile time constant N (>= 0).
  • Array creation [x; N] and [x, y, z].
  • Array is Copy as long as the element type is Copy.
  • Arrays always derefence to slices, so they have slice methods too.

@bluss bluss assigned bluss and unassigned pcwalton Jul 9, 2015
@tshepang
Copy link
Member Author

tshepang commented Jul 9, 2015

@bluss I don't mind if you add that extra info to either this PR or a follow-up... I don't have the knowledge of those things you mention.

@bluss
Copy link
Member

bluss commented Jul 9, 2015

Sounds like they need to be documented then!

@bluss
Copy link
Member

bluss commented Jul 9, 2015

@bors: r+ rollup

thanks! This is the starting point

@bors
Copy link
Contributor

bors commented Jul 9, 2015

📌 Commit c4c5c2d has been approved by bluss

@bors
Copy link
Contributor

bors commented Jul 9, 2015

⌛ Testing commit c4c5c2d with merge 92a95fe...

bors added a commit that referenced this pull request Jul 9, 2015
@tshepang
Copy link
Member Author

tshepang commented Jul 9, 2015

Take the following @bluss:

Array creation [x; N] and [x, y, z].

Did you mean that I should mention that one doesn't need to explicitly mention the type (i.e. [i32; 3])?

@bluss
Copy link
Member

bluss commented Jul 9, 2015

No but that (the expression) [x; N] creates a fixed size array (if the type of x is Copy) where every element has value x.

@bors bors merged commit c4c5c2d into rust-lang:master Jul 9, 2015
@tshepang tshepang deleted the array-examples branch July 9, 2015 20:18
@bluss
Copy link
Member

bluss commented Jul 9, 2015

#26923 is the follow-up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants