-
Notifications
You must be signed in to change notification settings - Fork 102
Fixed formatting with clippy and removed Document trait #261
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
Conversation
Thanks 🙏 Could you update the .code-samples.meilisearch.yaml file ? |
Hey, thanks for your contribution! |
Thank you everyone, unfortunately my macbook literally just died (screen fried) the moment I pushed up this PR. I'll see how fast I can get a new one but it might delay any further updates from me :/ |
@bidoubiwa @irevoire back with a new M1 mac and updated the code samples |
remove unnecessary lifetime syntax Co-authored-by: Tamo <[email protected]>
fix and update import syntax for documentation Co-authored-by: Tamo <[email protected]>
remove unnecessary lifetime syntax from function signature Co-authored-by: Tamo <[email protected]>
fix imports in documentation Co-authored-by: Tamo <[email protected]>
fix imports in documentation Co-authored-by: Tamo <[email protected]>
fix parameter value in documentation Co-authored-by: Tamo <[email protected]>
fix imports in documentation Co-authored-by: Tamo <[email protected]>
fix imports in documentation Co-authored-by: Tamo <[email protected]>
fix spacing in documentation Co-authored-by: Tamo <[email protected]>
@irevoire the changes are breaking somehow for the users? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@honne23 thanks for your contribution! ❤️
But I need your help to fix the README :)
Check it out: https://github.com/meilisearch/meilisearch-rust/runs/6065376469?check_suite_focus=true
@brunoocasali yes it's breaking |
|
||
/// Alias for [Index::add_or_replace]. | ||
pub async fn add_documents<T: Document>( | ||
pub async fn add_documents<T: DeserializeOwned + Serialize + std::fmt::Debug>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DeserializeOwned is not necessary here. Remove it so that we can add docs like this:
#[derive(Serialize, Debug)]
struct Movie<'a> {
name: &'a str,
description: &'a str,
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a little discussion on our slack community a few days ago where @honne23 explained to us why the Owned version was needed;
The issue here is not about Owned or not. The add_documents
only need to serialize the data, So neither DeserializeOwned
or Deserialize
is needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes you're right my bad!
/// ``` | ||
pub async fn get_document<T: 'static + Document>(&self, uid: T::UIDType) -> Result<T, Error> { | ||
Ok(request::<(), T>( | ||
pub async fn get_document<T: 'static + DeserializeOwned+ Serialize>(&self, uid: &str) -> Result<T, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the Serialize bound.
/// # }); | ||
/// ``` | ||
pub async fn get_documents<T: 'static + Document>( | ||
pub async fn get_documents<T: 'static + DeserializeOwned + Serialize + std::fmt::Debug>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also remove the std::fmt::Debug
here from what I see 👍
working on this today, will push this through later |
/// # }); | ||
/// ``` | ||
pub async fn add_or_replace<T: Document>( | ||
pub async fn add_or_replace<T: DeserializeOwned + Serialize + std::fmt::Debug>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, if we can we should remove the Debug
Hey, @honne23, I would like to merge this PR soon. Do you think you'll be able to work on it today? |
Closing in favor of #267 Thanks for your contribution 💝 |
267: fixed formatting with clippy and removed Document trait r=brunoocasali a=irevoire # Pull Request Since `@honne23` doesn't seem available currently, and we have #262, #263, and #264 waiting for this PR to be merged, I took back on it. But thanks a lot, `@honne23;` you wrote most of the code, and I just applied the few left comments. Thanks for contributing! ## What does this PR do? Fixes #255 Closes #261 <!-- Please link the issue you're trying to fix with this PR, if none then please create an issue first. --> ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Adrian Coutsoftides <[email protected]> Co-authored-by: Bruno Casali <[email protected]>
267: fixed formatting with clippy and removed Document trait r=brunoocasali a=irevoire # Pull Request Since `@honne23` doesn't seem available currently, and we have #262, #263, and #264 waiting for this PR to be merged, I took back on it. But thanks a lot, `@honne23;` you wrote most of the code, and I just applied the few left comments. Thanks for contributing! ## What does this PR do? Fixes #255 Closes #261 <!-- Please link the issue you're trying to fix with this PR, if none then please create an issue first. --> ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Adrian Coutsoftides <[email protected]> Co-authored-by: Bruno Casali <[email protected]>
Pull Request
What does this PR do?
Fixes #255
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!