Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save federicomenaquintero/83631495781c37a12966907f3eda106f to your computer and use it in GitHub Desktop.
Save federicomenaquintero/83631495781c37a12966907f3eda106f to your computer and use it in GitHub Desktop.
enum MarkerType {
Start,
Middle,
End
}
type RenderMarkerFn = fn (MarkerType,
f64, // xpos
f64, // ypos
f64); // computed_angle
// This is fine
fn emit_marker_at_start_of_segment (some args ...,
emit_fn: RenderMarkerFn) { ... }
// I get an error when I call that like this
emit_marker_at_start_of_segment (builder,
|marker_type: MarkerType, x: f64, y: f64, computed_angle: f64| { ... });
| __________________________^ starting here...
= note: expected type `fn(marker::MarkerType, f64, f64, f64)`
= note: found type `[closure@marker.rs:683:36: 690:37 draw_ctx:_, linewidth:_]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment