Skip to content

feat(QoL): Renames some functions to a more stadard rust naming - #1673

Closed
naomijub wants to merge 1 commit into
godot-rust:masterfrom
naomijub:naomijub/rust-style-fn-renaming
Closed

feat(QoL): Renames some functions to a more stadard rust naming#1673
naomijub wants to merge 1 commit into
godot-rust:masterfrom
naomijub:naomijub/rust-style-fn-renaming

Conversation

@naomijub

@naomijub naomijub commented Aug 4, 2026

Copy link
Copy Markdown

As per #1672

What

Renames a set of accessor/constructor methods across gdext to follow standard
Rust naming conventions for fallibility:

  • get_* : returns Option<T> when the operation is a genuine lookup that
    may not find anything (mirrors an existing Godot get_*_or_null-style method).
  • checked_*: returns Option<T> when the operation is a construction or
    conversion
    that validates before returning (not a lookup).
  • try_* : reserved for methods returning Result<T, E>, distinguishing why
    an operation failed.
  • Plain method name: panicking variant.

Changes

  • Node::get_node_as / Node::try_node_as
  • PackedScene::instantiate_as / try_instantiate_as

Why

Rust conventions establish get as Option-returning (HashMap::get,
slice::get) and try_ as Result-returning (TryFrom, etc.), the previous
naming had this inverted, which is surprising for anyone coming from std.

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.

1 participant