Skip to content

Translate various error types to Result<(), T> #846

@madsmtm

Description

@madsmtm

Objective-C methods generally return errors via NSError, but it's not so standardized across the C-like functions, those usually return an integer that you have to test against. For example:

pub fn CGDisplayCapture(display: CGDirectDisplayID) -> CGError { ... }

It'd be nice if we could make this return something like Result<(), CGError> instead, with the "success" case already checked.

Types we'd want to handle:

  • CGError
  • CFSocketError
  • OSStatus
  • CVReturn
  • kern_return_t
  • ... probably more?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frameworkAffects the framework crates and the translator for themenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions