Code Monkey home page Code Monkey logo

Comments (5)

maxicarlos08 avatar maxicarlos08 commented on May 23, 2024

Camera has a reference to a Context since it is required for most camera operations, its ok to keep the Camera lifetime for the Context right?

from gphoto2-rs.

RReverser avatar RReverser commented on May 23, 2024

Camera has a reference to a Context since it is required for most camera operations, its ok to keep the Camear lifetime for the Context right?

In principle, yes, but personally I'd instead use gp_context_ref + gp_context_unref to avoid lifetime and instead use gphoto's reference counting.

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 23, 2024

This is actually great! Now you can initialize the camera without having to keep the context variable:

use gphoto2::{Result, Context};

fn main() -> Result<()> {
    let camera = Context::new()?.autodetect_camera()?; // This now compiles 🎉

    Ok(())
}

Thx for the reminder that gphoto had its own referencing counting!

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 23, 2024

v1.3.4 Now includes (almost, except for CameraFS and WidgetIterator) no more lifetimes

from gphoto2-rs.

RReverser avatar RReverser commented on May 23, 2024

v1.3.4 Now includes (almost, except for CameraFS and WidgetIterator) no more lifetimes

I suspect technically it should've been 1.4.0 as it's an API breaking change, but otherwise great!

from gphoto2-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.