Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve documentation of slicing methods.#989

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cassiersg wants to merge1 commit intorust-ndarray:master
base:master
Choose a base branch
Loading
fromcassiersg:patch-2

Conversation

cassiersg
Copy link
Contributor

No description provided.

@jturner314
Copy link
Member

jturner314 commentedApr 30, 2021
edited
Loading

Thanks for suggesting improvements to the docs.

It's somewhat awkward to reference a few other slicing methods without listing all of the potentially relevant ones. However, I don't think we should list all of them, since there are a lot of slicing methods, and they're all mentioned in theSlicing docs already.

What I'd suggest is to address the question in#988 more directly, i.e. add something like the following to the docs for.slice():

Note that the lifetime of the resulting slice corresponds to the&self borrow. If you want a slice with the same lifetime as an existing view, clone/copy the view if necessary and then use.slice_move() or.slice_collapse().

and add the following to the docs for.slice_mut():

Note that the lifetime of the resulting slice corresponds to the&mut self borrow. If you want a slice with the same lifetime as an existing view, use.slice_move(),.multi_slice_move(), or.slice_collapse() on the view.

We could also add analogous comments to the docs ofslice_axis/_mut (referencingslice_axis_inplace) andslice_each_axis/_mut (referencingslice_each_axis_inplace).

One other note: the markup of the links in this PR isn't quite right. A link should be formatted like this:

some text [the link text](url) more text

or like this:

some text [the link text] more text[the link text]: url

Note also that as of Rust 1.48.0, it's possible touse the Rust path of an in-scope item as a "URL", and as of Rust 1.51.0, this works for associated items too, such as writing[.slice()](ArrayBase::slice).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@cassiersg@jturner314

[8]ページ先頭

©2009-2025 Movatter.jp