Skip to content

Added information about examples as libraries to the documentation #3582

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

Merged

Conversation

KalitaAlexey
Copy link
Contributor

Allow examples to be library has been committed.
The PR adds information to the documentation.

@KalitaAlexey
Copy link
Contributor Author

@alexcrichton,
Is brson available or should I reassign the PR to you?

@@ -451,13 +451,19 @@ To structure your code after you've created the files and folders for your proje
Files located under `examples` are example uses of the functionality provided by
the library. When compiled, they are placed in the `target/examples` directory.

They must compile as executables (with a `main()` function) and load in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this paragraph could be:

They can compile as executables (with a main() function) or libraries and pull in the main library through extern crate <library-name>. Examples are compiled when you run your tests to prevent them from bitrotting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton,
I am not a native speaker, so if you say so I will change.
I am curious.
Why my sentence is invalid?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh there wasn't anything wrong with it, it just seemed to not flow well having two sentences starting with 'They' back-to-back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on updating this paragraph?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already updated it.

<example-name>`.

Specify `crate-type` to make an example be compiled as a library:
```toml
[[example.example]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just [[example]], right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it isn't.
.example means an example with name example.
Should I change it to .foo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok well as the author of Cargo and implementor of this feature I'm saying [[example.example]] is invalid. The correct syntax is [[example]]

Copy link
Contributor Author

@KalitaAlexey KalitaAlexey Jan 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton,
Yes, indeed.
I am sorry.
I saw that somewhere. I will change that.

[ci skip]
<example-name>`.

Specify `crate-type` to make an example be compiled as a library:
```toml
[[example.foo]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The '.foo' here needs to be removed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that I am stupid.
Sorry.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 25, 2017

📌 Commit 5caee7f has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jan 25, 2017

⌛ Testing commit 5caee7f with merge 69f03dc...

bors added a commit that referenced this pull request Jan 25, 2017
…es, r=alexcrichton

Added information about examples as libraries to the documentation

[Allow examples to be library](#3556) has been committed.
The PR adds information to the documentation.
@KalitaAlexey
Copy link
Contributor Author

@alexcrichton,
It failed.

@bors
Copy link
Contributor

bors commented Jan 25, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 69f03dc to master...

@bors bors merged commit 5caee7f into rust-lang:master Jan 25, 2017
@KalitaAlexey KalitaAlexey deleted the add-info-about-examples-as-libraries branch January 25, 2017 20:46
@ehuss ehuss added this to the 1.16.0 milestone Feb 6, 2022
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.

5 participants