sdk-rust icon indicating copy to clipboard operation
sdk-rust copied to clipboard

Event does not have `new` method

Open xiaoas opened this issue 3 years ago • 1 comments

Users expect to use Event::new() to construct a event. According to API guideline: https://rust-lang.github.io/api-guidelines/predictability.html

  • we should implement Event::new()
  • we should revise the doc to encourage the use of Event::new()`

xiaoas avatar Mar 08 '23 06:03 xiaoas

I believe this is intentional. Instead, the builder pattern is used to force compliance with the different CloudEvent Spec versions (0.3 and 1.0). It aligns with this note in the API guidelines:

If your type has a multiplicity of construction options though, consider the builder pattern (C-BUILDER) instead.

ozabalaferrera avatar Nov 10 '24 03:11 ozabalaferrera