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

Deriving ElasticType Implements DocumentType #76

Open
KodrAus opened this issue May 30, 2017 · 1 comment
Open

Deriving ElasticType Implements DocumentType #76

KodrAus opened this issue May 30, 2017 · 1 comment

Comments

@KodrAus
Copy link
Member

KodrAus commented May 30, 2017

It's a bit weird that deriving ElasticType implements a trait called DocumentType (it might also add a mapping type and derive traits for that).

This should be aligned with the trait bound you'd use to accept a document type.

The options are:

Rename DocumentType to ElasticType:

#[derive(ElasticType)]
struct MyData {
    id: i32,
    title: String
}

fn with_doc<TDocument: ElasticType>(doc: TDocument) {

}

Rename ElasticType to DocumentType:

#[derive(DocumentType)]
struct MyData {
    id: i32,
    title: String
}

fn with_doc<TDocument: DocumentType>(doc: TDocument) {

}

Rename both to ElasticDocument:

#[derive(ElasticDocument)]
struct MyData {
    id: i32,
    title: String
}

fn with_doc<TDocument: ElasticDocument>(doc: TDocument) {

}

I don't have a strong leaning yet. I'll play with it in some actual code and see which one works out best.

@KodrAus
Copy link
Member Author

KodrAus commented Jun 27, 2017

The same goes for deriving ElasticDateFormat.

I'll do an experiment and see what happens if you have conflicting derives.

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

No branches or pull requests

1 participant